Sha256: 4476d647bf9944aa9d85a117fa28c43bff363ed9e3520d1f75afb964c78c4d64
Contents?: true
Size: 893 Bytes
Versions: 1
Compression:
Stored size: 893 Bytes
Contents
module Shopper module ModelMethods extend ::ActiveSupport::Concern module ClassMethods def acts_as_product define_method :product_type do self.class.to_s.underscore end has_many :order_items, class_name: 'Shopper::OrderItem', as: :product, dependent: :destroy end def acts_as_customer has_many :orders, class_name: 'Shopper::Order', as: :customer, dependent: :destroy has_one :billing_address, class_name: 'Shopper::BillingAddress', as: :addressable, dependent: :destroy has_one :shipping_address, class_name: 'Shopper::ShippingAddress', as: :addressable, dependent: :destroy end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoppper-0.1.0 | lib/shopper/model_methods.rb |