lib/reviewed/product.rb in reviewed-0.0.6 vs lib/reviewed/product.rb in reviewed-0.0.7

- old
+ new

@@ -1,14 +1,18 @@ +require 'reviewed/attachment' + module Reviewed class Product < Base + has_many :attachments + def attachments(tag=nil) if tag.present? - @attributes[:attachments].select do |attachment| + @attributes.attachments.select do |attachment| attachment_tags = attachment.tags || [] attachment_tags.map(&:downcase).include?(tag.downcase) end else - @attributes[:attachments] + @attributes.attachments end end end end