| Class | Sequel::Model::Associations::OneToManyAssociationReflection |
| In: |
lib/sequel/model/associations.rb
|
| Parent: | AssociationReflection |
The keys in the associated model‘s table related to this association
# File lib/sequel/model/associations.rb, line 223
223: def associated_object_keys
224: self[:keys]
225: end
one_to_many associations can only have associated objects if none of the :keys options have a nil value.
# File lib/sequel/model/associations.rb, line 229
229: def can_have_associated_objects?(obj)
230: !self[:primary_keys].any?{|k| obj.send(k).nil?}
231: end
Default foreign key name symbol for key in associated table that points to current table‘s primary key.
# File lib/sequel/model/associations.rb, line 235
235: def default_key
236:
237: "#{underscore(demodulize(self[:model].name))}_id"
238: end
The column in the current table that the key in the associated table references.
# File lib/sequel/model/associations.rb, line 240
240: def primary_key
241: self[:primary_key] ||= self[:model].primary_key
242: end
Whether the reciprocal of this association returns an array of objects instead of a single object, false for a one_to_many association.
# File lib/sequel/model/associations.rb, line 252
252: def reciprocal_array?
253: false
254: end
The one_to_many association needs to check that an object to be removed already is associated.
# File lib/sequel/model/associations.rb, line 257
257: def remove_should_check_existing?
258: true
259: end