Class: ThroughHierarchy::Associations::HasOne
- Inherits:
-
Association
- Object
- Association
- ThroughHierarchy::Associations::HasOne
- Defined in:
- lib/through_hierarchy/associations/has_one.rb
Instance Method Summary collapse
Methods inherited from Association
Constructor Details
This class inherits a constructor from ThroughHierarchy::Associations::Association
Instance Method Details
#find(instance) ⇒ Object
4 5 6 7 8 |
# 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 |