Class Sequel::Model::Associations::OneToOneAssociationReflection
In: lib/sequel/model/associations.rb
Parent: OneToManyAssociationReflection

Methods

Public Instance methods

one_to_one associations don‘t use an eager limit strategy by default, but support both DISTINCT ON and window functions as strategies.

[Source]

     # File lib/sequel/model/associations.rb, line 425
425:         def eager_limit_strategy
426:           cached_fetch(:_eager_limit_strategy) do
427:             case s = self[:eager_limit_strategy]
428:             when Symbol
429:               s
430:             when true
431:               ds = associated_class.dataset
432:               if ds.supports_ordered_distinct_on?
433:                 :distinct_on
434:               elsif ds.supports_window_functions?
435:                 :window_function
436:               end
437:             else
438:               nil
439:             end
440:           end
441:         end

The limit and offset for this association (returned as a two element array).

[Source]

     # File lib/sequel/model/associations.rb, line 444
444:         def limit_and_offset
445:           [1, nil]
446:         end

one_to_one associations return a single object, not an array

[Source]

     # File lib/sequel/model/associations.rb, line 449
449:         def returns_array?
450:           false
451:         end

[Validate]