lib/reviewed/article.rb in reviewed-0.0.3 vs lib/reviewed/article.rb in reviewed-0.0.4

- old
+ new

@@ -8,9 +8,13 @@ (@attributes[:products] || []).map do |product| Reviewed::Product.new(product) end end + def primary_product + products.select { |p| p.id == primary_product_id }.first + end + def attachments(tag=nil) if tag.present? @attributes[:attachments].select do |attachment| attachment_tags = attachment.tags || [] attachment_tags.map(&:downcase).include?(tag.downcase)