lib/reviewed/article.rb in reviewed-0.0.2 vs lib/reviewed/article.rb in reviewed-0.0.3
- old
+ new
@@ -2,9 +2,15 @@
class Article < Base
def find_page(slug)
pages.find { |page| page.slug.match(/#{slug}/i) }
end
+ def products
+ (@attributes[:products] || []).map do |product|
+ Reviewed::Product.new(product)
+ end
+ end
+
def attachments(tag=nil)
if tag.present?
@attributes[:attachments].select do |attachment|
attachment_tags = attachment.tags || []
attachment_tags.map(&:downcase).include?(tag.downcase)