From 74b77e132ddd44ba6914854034c2476baf83085e Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 10 Jul 2020 21:22:10 -0700 Subject: [PATCH] A bit of a hack to accept any webpage... --- app/models/commercial.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/models/commercial.rb b/app/models/commercial.rb index 5acda134..51f8b7f5 100644 --- a/app/models/commercial.rb +++ b/app/models/commercial.rb @@ -18,10 +18,16 @@ class Commercial < ApplicationRecord resource = OEmbed::Providers.get(url, maxwidth: 560, maxheight: 315) { html: resource.html.html_safe } rescue StandardError => exception - { error: exception.message } + { html: iframe_fallback(url) } + # { error: exception.message } end end + def self.iframe_fallback(url) + #
Open in a new tab + "".html_safe + end + def self.read_file(file) errors = {} errors[:no_event] = [] @@ -67,11 +73,10 @@ class Commercial < ApplicationRecord OEmbed::Providers::Instagram, speakerdeck ) - - OEmbed::Providers.register_fallback( - OEmbed::ProviderDiscovery, - OEmbed::Providers::Noembed - ) + # OEmbed::Providers.register_fallback( + # OEmbed::ProviderDiscovery, + # OEmbed::Providers::Noembed + # ) end def conference_id