Class Index [+]

Quicksearch

Sequel::Model::Associations::ManyToOneAssociationReflection

Public Instance Methods

associated_object_keys() click to toggle source
Alias for: primary_keys
can_have_associated_objects?(obj) click to toggle source

many_to_one associations can only have associated objects if none of the :keys options have a nil value.

     # File lib/sequel/model/associations.rb, line 265
265:         def can_have_associated_objects?(obj)
266:           !self[:keys].any?{|k| obj.send(k).nil?}
267:         end
dataset_need_primary_key?() click to toggle source

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

     # File lib/sequel/model/associations.rb, line 270
270:         def dataset_need_primary_key?
271:           false
272:         end
default_key() click to toggle source

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 276
276:         def default_key
277:           :"#{self[:name]}_id"
278:         end
eager_graph_lazy_dataset?() click to toggle source

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 282
282:         def eager_graph_lazy_dataset?
283:           self[:key].nil?
284:         end
eager_limit_strategy() click to toggle source

many_to_one associations don’t need an eager limit strategy

     # File lib/sequel/model/associations.rb, line 287
287:         def eager_limit_strategy
288:           nil
289:         end
eager_loader_key() click to toggle source

The key to use for the key hash when eager loading

     # File lib/sequel/model/associations.rb, line 292
292:         def eager_loader_key
293:           cached_fetch(:eager_loader_key){self[:key]}
294:         end
primary_key() click to toggle source

The column(s) in the associated table that the key in the current table references (either a symbol or an array).

     # File lib/sequel/model/associations.rb, line 297
297:         def primary_key
298:          cached_fetch(:primary_key){associated_class.primary_key}
299:         end
primary_key_method() click to toggle source

The method symbol or array of method symbols to call on the associated object to get the value to use for the foreign keys.

     # File lib/sequel/model/associations.rb, line 309
309:         def primary_key_method
310:          cached_fetch(:primary_key_method){primary_key}
311:         end
primary_key_methods() click to toggle source

The array of method symbols to call on the associated object to get the value to use for the foreign keys.

     # File lib/sequel/model/associations.rb, line 315
315:         def primary_key_methods
316:          cached_fetch(:primary_key_methods){Array(primary_key_method)}
317:         end
primary_keys() click to toggle source

The columns in the associated table that the key in the current table references (always an array).

     # File lib/sequel/model/associations.rb, line 302
302:         def primary_keys
303:          cached_fetch(:primary_keys){Array(primary_key)}
304:         end
Also aliased as: associated_object_keys
qualified_primary_key() click to toggle source

primary_key qualified by the associated table

     # File lib/sequel/model/associations.rb, line 320
320:         def qualified_primary_key
321:           cached_fetch(:qualified_primary_key){self[:qualify] == false ? primary_key : qualify_assoc(primary_key)}
322:         end
reciprocal_array?() click to toggle source

True only if the reciprocal is a one_to_many association.

     # File lib/sequel/model/associations.rb, line 325
325:         def reciprocal_array?
326:           !set_reciprocal_to_self?
327:         end
returns_array?() click to toggle source

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

     # File lib/sequel/model/associations.rb, line 331
331:         def returns_array?
332:           false
333:         end
set_reciprocal_to_self?() click to toggle source

True only if the reciprocal is a one_to_one association.

     # File lib/sequel/model/associations.rb, line 336
336:         def set_reciprocal_to_self?
337:           reciprocal
338:           reciprocal_type == :one_to_one
339:         end

Private Instance Methods

reciprocal_type() click to toggle source

The reciprocal type of a many_to_one association is either a one_to_many or a one_to_one association.

     # File lib/sequel/model/associations.rb, line 345
345:         def reciprocal_type
346:           cached_fetch(:reciprocal_type){[:one_to_many, :one_to_one]}
347:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.