lib/reviewed/article.rb in reviewed-0.1.2 vs lib/reviewed/article.rb in reviewed-0.1.4
- old
+ new
@@ -11,10 +11,12 @@
def find_page(slug)
pages.find { |page| page.slug.match(/#{slug}/i) }
end
def primary_product
- products.select { |p| p.id == primary_product_id }.first
+ if respond_to?(:products)
+ products.select { |p| p.id == primary_product_id }.first
+ end
end
def attachments(tag=nil)
if tag.present?
@attributes.attachments.select do |attachment|