Sha256: 19ecfd4e532b3ae7e85fa906bb71c74899e526fecfe30c59f398d016b86510cd

Contents?: true

Size: 475 Bytes

Versions: 9

Compression:

Stored size: 475 Bytes

Contents

require 'reviewed/attachment'

module Reviewed
  class Product < Base
    has_many :attachments
    has_many :manufacturer_specs
    has_many :awards
    has_one  :brand

    def attachments(tag=nil)
      if tag.present?
        @attributes.attachments.select do |attachment|
          attachment_tags = attachment.tags || []
          attachment_tags.map(&:downcase).include?(tag.downcase)
        end
      else
        @attributes.attachments
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
reviewed-0.2.2 lib/reviewed/product.rb
reviewed-0.2.1 lib/reviewed/product.rb
reviewed-0.2.0 lib/reviewed/product.rb
reviewed-0.1.4 lib/reviewed/product.rb
reviewed-0.1.32 lib/reviewed/product.rb
reviewed-0.1.31 lib/reviewed/product.rb
reviewed-0.1.30 lib/reviewed/product.rb
reviewed-0.1.29 lib/reviewed/product.rb
reviewed-0.1.28 lib/reviewed/product.rb