Sha256: 5e89188fd7ac2dd33e8a8ea524ffe3b6a9ce1ca1fd5f7bff456f53b5c36bd039

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

module Spree
  class Property < ActiveRecord::Base
    has_and_belongs_to_many :prototypes, :join_table => :spree_properties_prototypes

    has_many :product_properties, :dependent => :destroy
    has_many :products, :through => :product_properties

    attr_accessible :name, :presentation

    validates :name, :presentation, :presence => true

    def self.find_all_by_prototype(prototype)
      id = prototype
      if prototype.class == Prototype
        id = prototype.id
      end
      joins("LEFT JOIN properties_prototypes ON property_id = #{self.table_name}.id").where(:prototype_id => id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-1.3.5 app/models/spree/property.rb
spree_core-1.3.4 app/models/spree/property.rb
spree_core-1.3.3 app/models/spree/property.rb
spree_core-1.3.2 app/models/spree/property.rb