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 498
498:         def eager_limit_strategy
499:           cached_fetch(:_eager_limit_strategy) do
500:             case s = self[:eager_limit_strategy]
501:             when Symbol
502:               s
503:             when true
504:               ds = associated_class.dataset
505:               if ds.supports_ordered_distinct_on?
506:                 :distinct_on
507:               elsif ds.supports_window_functions?
508:                 :window_function
509:               end
510:             else
511:               nil
512:             end
513:           end
514:         end

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

[Source]

     # File lib/sequel/model/associations.rb, line 517
517:         def limit_and_offset
518:           [1, nil]
519:         end

one_to_one associations return a single object, not an array

[Source]

     # File lib/sequel/model/associations.rb, line 522
522:         def returns_array?
523:           false
524:         end

[Validate]