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 389
389:         def eager_limit_strategy
390:           fetch(:_eager_limit_strategy) do
391:             self[:_eager_limit_strategy] = case s = self[:eager_limit_strategy]
392:             when Symbol
393:               s
394:             when true
395:               ds = associated_class.dataset
396:               if ds.supports_ordered_distinct_on?
397:                 :distinct_on
398:               elsif ds.supports_window_functions?
399:                 :window_function
400:               end
401:             else
402:               nil
403:             end
404:           end
405:         end

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

[Source]

     # File lib/sequel/model/associations.rb, line 408
408:         def limit_and_offset
409:           [1, nil]
410:         end

one_to_one associations return a single object, not an array

[Source]

     # File lib/sequel/model/associations.rb, line 413
413:         def returns_array?
414:           false
415:         end

[Validate]