Class | Sequel::Model::Associations::OneToOneAssociationReflection |
In: |
lib/sequel/model/associations.rb
|
Parent: | OneToManyAssociationReflection |
one_to_one associations don‘t use an eager limit strategy by default, but support both DISTINCT ON and window functions as strategies.
# File lib/sequel/model/associations.rb, line 483 483: def eager_limit_strategy 484: cached_fetch(:_eager_limit_strategy) do 485: offset = limit_and_offset.last 486: case s = self.fetch(:eager_limit_strategy){(self[:model].default_eager_limit_strategy || :ruby) if offset} 487: when Symbol 488: s 489: when true 490: ds = associated_class.dataset 491: if ds.supports_ordered_distinct_on? && offset.nil? 492: :distinct_on 493: elsif ds.supports_window_functions? 494: :window_function 495: else 496: :ruby 497: end 498: else 499: nil 500: end 501: end 502: end
The limit and offset for this association (returned as a two element array).
# File lib/sequel/model/associations.rb, line 505 505: def limit_and_offset 506: if (v = self[:limit]).is_a?(Array) 507: v 508: else 509: [v, nil] 510: end 511: end