Sha256: df0237302e871e52061e594807db97b53f65974fff93a5ab47dd8aebd3ac52c9

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

class Property < ActiveRecord::Base
  has_and_belongs_to_many :prototypes

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

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

  scope :sorted, order(:name)

  def self.find_all_by_prototype(prototype)
    id = prototype
    if prototype.class == Prototype
      id = prototype.id
    end

    find(:all, :conditions => [ 'prototype_id = ?', id ],
         :joins => 'left join properties_prototypes on property_id = properties.id')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-0.30.2 app/models/property.rb
spree_core-0.30.1 app/models/property.rb
spree_core-0.30.0 app/models/property.rb
spree_core-0.30.0.beta1 app/models/property.rb