Module: ActiveRecord::Collections::Collectable::Relation
- Defined in:
- lib/active_record/collections/collectable.rb
Instance Method Summary collapse
- #collection ⇒ Object (also: #to_collection)
- #kollektion ⇒ Object
- #values_hash ⇒ Object (also: #to_values_hash)
Instance Method Details
#collection ⇒ Object Also known as: to_collection
38 39 40 41 42 43 44 |
# File 'lib/active_record/collections/collectable.rb', line 38 def collection # do this with a hash so that we don't cause the relation query to execute c = kollektion.from_hash(values_hash) # TODO do we even need to do from_hash here? can we just create a new from_relation method instead that re-uses the same relation if we're already loaded? c.instance_variable_set(:@relation, self) if loaded? c end |
#kollektion ⇒ Object
29 30 31 |
# File 'lib/active_record/collections/collectable.rb', line 29 def kollektion klass.kollektion end |
#values_hash ⇒ Object Also known as: to_values_hash
33 34 35 |
# File 'lib/active_record/collections/collectable.rb', line 33 def values_hash ActiveRecord::Collections::Serializer.to_hash(values.merge({collectable: klass})) end |