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 377
377:         def eager_limit_strategy
378:           fetch(:_eager_limit_strategy) do
379:             self[:_eager_limit_strategy] = case s = self[:eager_limit_strategy]
380:             when Symbol
381:               s
382:             when true
383:               ds = associated_class.dataset
384:               if ds.supports_ordered_distinct_on?
385:                 :distinct_on
386:               elsif ds.supports_window_functions?
387:                 :window_function
388:               end
389:             else
390:               nil
391:             end
392:           end
393:         end

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

[Source]

     # File lib/sequel/model/associations.rb, line 396
396:         def limit_and_offset
397:           [1, nil]
398:         end

one_to_one associations return a single object, not an array

[Source]

     # File lib/sequel/model/associations.rb, line 401
401:         def returns_array?
402:           false
403:         end

[Validate]