diff --git a/app/controllers/faqs_controller.rb b/app/controllers/faqs_controller.rb index 7cc5a11..895e39d 100644 --- a/app/controllers/faqs_controller.rb +++ b/app/controllers/faqs_controller.rb @@ -45,7 +45,9 @@ class FaqsController < ApplicationController tags = faq.tags.map{|tag| { "tag" => tag.name } } rescue [] temp_rich_title = Nokogiri::HTML(faq.rich_title).css('body') temp_rich_title.children.each_with_index do |child,i| - temp_rich_title.children[i].attribute('style').value = child.attribute('style').value.gsub(/\b(?:font-size\s*?:\s*([^;>]*?)(?=[;">}]))/,'') + if !child.attribute('style').nil? + temp_rich_title.children[i].attribute('style').value = child.attribute('style').value.gsub(/\b(?:font-size\s*?:\s*([^;>]*?)(?=[;">}]))/,'') + end end { "extras" => {"question" => temp_rich_title,"answer" => faq.answer},