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 236 236: def associated_object_keys 237: self[:keys] 238: 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 242 242: def can_have_associated_objects?(obj) 243: !self[:primary_keys].any?{|k| obj.send(k).nil?} 244: 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 248 248: def default_key 249: 250: "#{underscore(demodulize(self[:model].name))}_id" 251: end
The key to use for the key hash when eager loading
# File lib/sequel/model/associations.rb, line 253 253: def eager_loader_key 254: self[:eager_loader_key] ||= primary_key 255: end
The column in the current table that the key in the associated table references.
# File lib/sequel/model/associations.rb, line 258 258: def primary_key 259: self[:primary_key] ||= self[:model].primary_key 260: 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 269 269: def reciprocal_array? 270: false 271: 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 274 274: def remove_should_check_existing? 275: true 276: end