through_hierarchy 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d022dd2e412e69e8daacf89cb32acdde7fa2aa8
4
- data.tar.gz: d3b3db0afcabfbc671be794845a3b6fd52e9f191
3
+ metadata.gz: 5ff191d3b67d67e1cdf99ba283b12873aa36624a
4
+ data.tar.gz: 879a24e56dec39d507381d20a57b89080d09453c
5
5
  SHA512:
6
- metadata.gz: b6c87687c6180d6eb104be80238b9e9cd77f62458af378b152b31c9c1567666457f5112e183fd310eeed208be669cfc30f8c616d312c8047afbbd327fdaa7ffa
7
- data.tar.gz: 2e39324c5fdee36ddfea5a839d58f37f93ce20410f041facfc21d38c8dd110925f8a0811bfbc89f9583fe23fe93f23a734a6aa1870d1824645082757d2c76540
6
+ metadata.gz: 8f0e6ed2807d23ebbb68813605bd34314ddba1c5a920e6c9d8d9684d2ff9eb529d5236698b439afc9430ef1ca8dd8f1144c10c9a8fc0add31c28bb48c9eb1cc3
7
+ data.tar.gz: 6397865dcf63f039c3ade88eb8ce90bbbf8ba639480872a8f54f59fea59d43d9edfce07357da808b61407a0cb87fdd80cf39d6a476144caa2c3a44fdfa0cb066
@@ -2,7 +2,8 @@ module ThroughHierarchy
2
2
  module Associations
3
3
  class HasOne < Association
4
4
  def find(instance)
5
- super.first
5
+ q = super
6
+ q.reorder(sql_hierarchy_rank).order(q.order_values).first
6
7
  end
7
8
  end
8
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: through_hierarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Schwartz