Module: Gorillib::Collection::ItemsBelongTo
- Extended by:
- Gorillib::Concern
- Includes:
- CommonAttrs
- Defined in:
- lib/gorillib/collection/model_collection.rb
Overview
Instance Method Summary collapse
- #add(item, *args) ⇒ Object
-
#initialize(*args) ⇒ Object
add this collection's belongs_to to the common attrs, so that a newly-created object knows its parentage from birth.
Methods included from Gorillib::Concern
append_features, extended, included
Methods included from CommonAttrs
Instance Method Details
#add(item, *args) ⇒ Object
149 150 151 152 |
# File 'lib/gorillib/collection/model_collection.rb', line 149 def add(item, *args) item.send("#{parentage_method}=", belongs_to) super end |
#initialize(*args) ⇒ Object
add this collection's belongs_to to the common attrs, so that a newly-created object knows its parentage from birth.
144 145 146 147 |
# File 'lib/gorillib/collection/model_collection.rb', line 144 def initialize(*args) super @common_attrs = self.common_attrs.merge(parentage_method => self.belongs_to) end |