Class: MOCO::Deal
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Deal
- Defined in:
- lib/moco/entities/deal.rb
Overview
Represents a MOCO deal Provides methods for deal-specific associations
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
- #category ⇒ Object
-
#company ⇒ Object
Associations.
- #to_s ⇒ Object
- #user ⇒ Object
Methods inherited from BaseEntity
#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update
Constructor Details
This class inherits a constructor from MOCO::BaseEntity
Instance Method Details
#category ⇒ Object
16 17 18 |
# File 'lib/moco/entities/deal.rb', line 16 def category association(:category, "DealCategory") end |
#company ⇒ Object
Associations
8 9 10 |
# File 'lib/moco/entities/deal.rb', line 8 def company association(:company) || association(:customer, "Company") end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/moco/entities/deal.rb', line 20 def to_s "#{name} (#{company&.name})" end |
#user ⇒ Object
12 13 14 |
# File 'lib/moco/entities/deal.rb', line 12 def user association(:user) end |