Sha256: 4161ff4c360c55ca0ee833a55eba79a549e88a73751b81b4deaf473bd80a43c6

Contents?: true

Size: 1004 Bytes

Versions: 6

Compression:

Stored size: 1004 Bytes

Contents

module Comable
  class Order < ActiveRecord::Base
    module Associations
      extend ActiveSupport::Concern

      included do
        belongs_to :user, class_name: Comable::User.name, autosave: false
        belongs_to :bill_address, class_name: Comable::Address.name, autosave: true, dependent: :destroy
        belongs_to :ship_address, class_name: Comable::Address.name, autosave: true, dependent: :destroy
        has_many :order_items, dependent: :destroy, class_name: Comable::OrderItem.name, inverse_of: :order
        has_one :payment, dependent: :destroy, class_name: Comable::Payment.name, inverse_of: :order
        has_one :shipment, dependent: :destroy, class_name: Comable::Shipment.name, inverse_of: :order

        accepts_nested_attributes_for :bill_address
        accepts_nested_attributes_for :ship_address
        accepts_nested_attributes_for :order_items
        accepts_nested_attributes_for :payment
        accepts_nested_attributes_for :shipment
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
comable-core-0.7.0.beta1 app/models/comable/order/associations.rb
comable-core-0.6.0 app/models/comable/order/associations.rb
comable_core-0.5.0 app/models/comable/order/associations.rb
comable_core-0.4.2 app/models/comable/order/associations.rb
comable_core-0.4.1 app/models/comable/order/associations.rb
comable_core-0.4.0 app/models/comable/order/associations.rb