class Sequel::Model::Associations::OneToOneAssociationReflection

  1. lib/sequel/model/associations.rb
Parent: Associations

Public Instance methods

eager_limit_strategy ()

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

[show source]
# File lib/sequel/model/associations.rb, line 545
def eager_limit_strategy
  cached_fetch(:_eager_limit_strategy) do
    offset = limit_and_offset.last
    case s = self.fetch(:eager_limit_strategy){(self[:model].default_eager_limit_strategy || :ruby) if offset}
    when Symbol
      s
    when true
      ds = associated_class.dataset
      if ds.supports_ordered_distinct_on? && offset.nil?
        :distinct_on
      elsif ds.supports_window_functions?
        :window_function
      else
        :ruby
      end
    else
      nil
    end
  end
end
limit_and_offset ()

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

[show source]
# File lib/sequel/model/associations.rb, line 567
def limit_and_offset
  if (v = self[:limit]).is_a?(Array)
    v
  else
    [v, nil]
  end
end
returns_array? ()

one_to_one associations return a single object, not an array

[show source]
# File lib/sequel/model/associations.rb, line 576
def returns_array?
  false
end