Sha256: 0fa739ce53130eb9a1fc4a27af5bffaaed91f9e8cc02df13be874f6f8767227f

Contents?: true

Size: 650 Bytes

Versions: 6

Compression:

Stored size: 650 Bytes

Contents

module Piggybak
  module ActsAsSellableWithVariants
    extend ActiveSupport::Concern

    module ClassMethods
      def acts_as_sellable_with_variants
        has_many :variants, :dependent => :destroy, :class_name => "::PiggybakVariants::Variant", :as => :item

        accepts_nested_attributes_for :variants, :allow_destroy => true
        attr_accessible :variants_attributes #, :allow_destroy => true
        validates_associated_bubbling :variants
        
        ::PiggybakVariants::OptionConfiguration::VARIANT_CLASSES << self.to_s
      end      
    end
  end
end

::ActiveRecord::Base.send :include, Piggybak::ActsAsSellableWithVariants

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
piggybak_variants-0.0.17 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.0.15 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.0.14 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.0.13 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.0.12 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.0.11 lib/acts_as_sellable_with_variants.rb