Sha256: d2c2dff4430d278abca9d054030fd80c744f38c18cc58bb90c9d58902372a678

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 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
        
        ::PiggybakVariants::OptionConfiguration::VARIANT_CLASSES << self.to_s
      end      
    end
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
piggybak_variants-0.1.3 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.1.2 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.1.1 lib/acts_as_sellable_with_variants.rb
piggybak_variants-0.1.0 lib/acts_as_sellable_with_variants.rb