Sha256: cce5897dd3a8d6922defa064a207711de9e6586021950d6e699807089b48a44d

Contents?: true

Size: 550 Bytes

Versions: 6

Compression:

Stored size: 550 Bytes

Contents

module Spree
  class ProductProperty < ActiveRecord::Base
    belongs_to :product, :class_name => "Spree::Product"
    belongs_to :property, :class_name => "Spree::Property"

    validates :property, :presence => true
    validates_length_of :value, :maximum => 255

    attr_accessible :property_name, :value

    # virtual attributes for use with AJAX completion stuff
    def property_name
      property.name if property
    end

    def property_name=(name)
      self.property = Property.find_by_name(name) unless name.blank?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_core-1.1.6 app/models/spree/product_property.rb
spree_core-1.1.5 app/models/spree/product_property.rb
spree_core-1.1.4 app/models/spree/product_property.rb
spree_core-1.1.3 app/models/spree/product_property.rb
spree_core-1.1.2 app/models/spree/product_property.rb
spree_core-1.1.2.rc1 app/models/spree/product_property.rb