Sha256: 5e8fb27d9ef8adcb0e8c411f345b16a20fde2f11c79f7efcb93901c6255ce08f

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

module Spree
  class OptionType < ActiveRecord::Base
    has_many :option_values, order: "#{Spree::OptionValue.quoted_table_name}.position", dependent: :destroy
    has_many :product_option_types, dependent: :destroy
    has_many :products, through: :product_option_types
    has_and_belongs_to_many :prototypes, join_table: 'spree_option_types_prototypes'

    attr_accessible :name, :presentation, :option_values_attributes

    validates :name, :presentation, presence: true
    default_scope order: "#{quoted_table_name}.position"

    accepts_nested_attributes_for :option_values, reject_if: lambda { |ov| ov[:name].blank? || ov[:presentation].blank? }, allow_destroy: true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_core-2.0.13 app/models/spree/option_type.rb