class ThroughHierarchy::Associations::HasOne

Public Instance Methods

find(instance) click to toggle source
# File lib/through_hierarchy/associations/has_one.rb, line 4
def find(instance)
  matches = super
  # ensure we order by hierarchy rank, but preserve scope orders
  matches.reorder(@associated.hierarchy_rank).order(matches.orders).first
end

Private Instance Methods

get_joins() click to toggle source
# File lib/through_hierarchy/associations/has_one.rb, line 12
def get_joins
  @associated.join_best_rank
end