Class: Sequel::Model::Associations::ManyToOneAssociationReflection

Class | Sequel::Model::Associations::ManyToOneAssociationReflection
In: | lib/sequel_model/association_reflection.rb
Parent: | AssociationReflection

### Methods

dataset_need_primary_key? default_key eager_graph_lazy_dataset? eager_loader_key primary_key returns_array?

### Public Instance methods

dataset_need_primary_key?()

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

[Source]

         # File lib/sequel_model/association_reflection.rb, line 131
    131:     def dataset_need_primary_key?
    132:       false
    133:     end

default_key()

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/association_reflection.rb, line 137
    137:     def default_key
    138:
    139:       "#{self[:name]}_id"
    140:     end

eager_graph_lazy_dataset?()

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

[Source]

         # File lib/sequel_model/association_reflection.rb, line 143
    143:     def eager_graph_lazy_dataset?
    144:       self[:key].nil?
    145:     end

eager_loader_key()

The key to use for the key hash when eager loading

[Source]

         # File lib/sequel_model/association_reflection.rb, line 148
    148:     def eager_loader_key
    149:       self[:key]
    150:     end

primary_key()

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

[Source]

         # File lib/sequel_model/association_reflection.rb, line 153
    153:     def primary_key
    154:      self[:primary_key] ||= associated_class.primary_key
    155:     end

returns_array?()

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/association_reflection.rb, line 159
    159:     def returns_array?
    160:       false
    161:     end

[Validate]