Class: Schemaker::Models::ObjectModel
- Defined in:
- lib/schemaker/models/object_model.rb
Instance Attribute Summary
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#configure ⇒ Object
Configures has_many through relationship via Join model for the object model (fx Role).
-
#initialize(models, clazz) ⇒ ObjectModel
constructor
A new instance of ObjectModel.
- #through_options(options = {}) ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(models, clazz) ⇒ ObjectModel
Returns a new instance of ObjectModel.
14 15 16 |
# File 'lib/schemaker/models/object_model.rb', line 14 def initialize models, clazz super end |
Instance Method Details
#configure ⇒ Object
Configures has_many through relationship via Join model for the object model (fx Role)
Example:
Role (object)
has_many :accounts, :class_name => 'RefManyAccount', :through => :accounts_roles (subject)
has_many :user_roles, :class_name => 'UserRole' (join)
24 25 26 27 |
# File 'lib/schemaker/models/object_model.rb', line 24 def configure super create_has_many_through :subject end |
#through_options(options = {}) ⇒ Object
Note:
important to use super to avoid recursive stack overflow!
30 31 32 |
# File 'lib/schemaker/models/object_model.rb', line 30 def = {} .merge super(:subject) end |