Class Sequel::Model::Associations::ManyToOneAssociationReflection
In: lib/sequel/model/associations.rb
Parent: AssociationReflection

Methods

Public Instance methods

Whether the dataset needs a primary key to function, false for many_to_one associations.

[Source]

     # File lib/sequel/model/associations.rb, line 149
149:         def dataset_need_primary_key?
150:           false
151:         end

Default foreign key name symbol for foreign key in current model‘s table that points to the given association‘s table‘s primary key.

[Source]

     # File lib/sequel/model/associations.rb, line 155
155:         def default_key
156: 
157:           "#{self[:name]}_id"
158:         end

Whether to eagerly graph a lazy dataset, true for many_to_one associations only if the key is nil.

[Source]

     # File lib/sequel/model/associations.rb, line 161
161:         def eager_graph_lazy_dataset?
162:           self[:key].nil?
163:         end

The key to use for the key hash when eager loading

[Source]

     # File lib/sequel/model/associations.rb, line 166
166:         def eager_loader_key
167:           self[:key]
168:         end

The column in the associated table that the key in the current table references.

[Source]

     # File lib/sequel/model/associations.rb, line 171
171:         def primary_key
172:          self[:primary_key] ||= associated_class.primary_key
173:         end

Whether this association returns an array of objects instead of a single object, false for a many_to_one association.

[Source]

     # File lib/sequel/model/associations.rb, line 177
177:         def returns_array?
178:           false
179:         end

[Validate]