Class | Sequel::Model::Associations::ManyToOneAssociationReflection |
In: |
lib/sequel/model/associations.rb
|
Parent: | AssociationReflection |
Whether the dataset needs a primary key to function, false for many_to_one associations.
# File lib/sequel/model/associations.rb, line 156 156: def dataset_need_primary_key? 157: false 158: 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.
# File lib/sequel/model/associations.rb, line 162 162: def default_key 163: 164: "#{self[:name]}_id" 165: end
Whether to eagerly graph a lazy dataset, true for many_to_one associations only if the key is nil.
# File lib/sequel/model/associations.rb, line 168 168: def eager_graph_lazy_dataset? 169: self[:key].nil? 170: end
The key to use for the key hash when eager loading
# File lib/sequel/model/associations.rb, line 173 173: def eager_loader_key 174: self[:key] 175: end
The column in the associated table that the key in the current table references.
# File lib/sequel/model/associations.rb, line 178 178: def primary_key 179: self[:primary_key] ||= associated_class.primary_key 180: end