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 443
443:         def eager_limit_strategy
444:           cached_fetch(:_eager_limit_strategy) do
445:             case s = self[:eager_limit_strategy]
446:             when Symbol
447:               s
448:             when true
449:               ds = associated_class.dataset
450:               if ds.supports_ordered_distinct_on?
451:                 :distinct_on
452:               elsif ds.supports_window_functions?
453:                 :window_function
454:               end
455:             else
456:               nil
457:             end
458:           end
459:         end

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

[Source]

     # File lib/sequel/model/associations.rb, line 462
462:         def limit_and_offset
463:           [1, nil]
464:         end

one_to_one associations return a single object, not an array

[Source]

     # File lib/sequel/model/associations.rb, line 467
467:         def returns_array?
468:           false
469:         end

[Validate]