Module: MerchantSidekick::Seller::ClassMethods
- Defined in:
- lib/merchant_sidekick/seller.rb
Instance Method Summary collapse
-
#acts_as_seller(options = {}) ⇒ Object
Defines helper methods for a person selling items.
Instance Method Details
#acts_as_seller(options = {}) ⇒ Object
Defines helper methods for a person selling items.
E.g.
class Merchant
acts_as_seller
...
end
# Selling a product to @customer
@merchant.sell_to @customer, @products
# Alternative syntax
@merchant.sell @products, :to => @customer
25 26 27 28 29 30 31 |
# File 'lib/merchant_sidekick/seller.rb', line 25 def acts_as_seller(={}) include MerchantSidekick::Seller::InstanceMethods has_many :orders, :as => :seller, :dependent => :destroy, :class_name => "::MerchantSidekick::Order" has_many :invoices, :as => :seller, :dependent => :destroy, :class_name => "::MerchantSidekick::Invoice" has_many :sales_orders, :as => :seller, :class_name => "::MerchantSidekick::SalesOrder" has_many :sales_invoices, :as => :seller, :class_name => "::MerchantSidekick::SalesInvoice" end |