through_hierarchy 0.1.2 → 0.1.3

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: 4c298c3d82954bcbdb17927662423bff146aeabb
4
- data.tar.gz: 4d14515633cf34b0fddb9d53fe6cfcc62466ddf0
3
+ metadata.gz: d035058e70928adac98eda0a5bfbb11f64511184
4
+ data.tar.gz: ea5fdd65f17ffca9c986110d25779d2cd77e2246
5
5
  SHA512:
6
- metadata.gz: 6cedbd9ab437b3bab6e2ffb882679b07a053f028ee1452b5b0dca985a4abb63a91e2ebac478435c0b41e6b7eaaddbfb6a8c53cc0f6035200b9650cf458955129
7
- data.tar.gz: abf0b810b772afc73d3bc7dd853f89a68f05ae2a61a6bdb5e0912eb95bf85a8260288da0b9c3f2d3d85ea682851e719420e76a92fa86254657effced0642aa59
6
+ metadata.gz: 7ffd8d6d39235e151ab3f1f66eb0fa0167065dc2d10626b50ec30f737a50818d4baf618e0cc7823a29cedc663cebdf9b7edfc4a1d86bbcffdc9c512514692d9e
7
+ data.tar.gz: ae0d68f9add8a0eb7b8bec6c10e6004e58219a31b1d744e130fac861d0ac760aa5de7e04c0f96552bcdb8e1b7f5327e39d3b4415a86d7d1c51c7dd93236717fb
@@ -14,6 +14,7 @@ module ThroughHierarchy
14
14
 
15
15
  def find(instance)
16
16
  results = get_matches(instance)
17
+ results = results.create_with(associated_instance(instance).create_with)
17
18
  results = results.instance_exec(&@scope) if @scope.present?
18
19
  return results
19
20
  end
@@ -20,6 +20,13 @@ module ThroughHierarchy
20
20
  and(foreign_key_column.eq(instance_key(instance)))
21
21
  end
22
22
 
23
+ def create_with
24
+ {
25
+ foreign_type_name => instance_type(@instance),
26
+ foreign_key_name => instance_key(@instance)
27
+ }
28
+ end
29
+
23
30
  def instance_type(instance)
24
31
  instance.class.base_class.to_s
25
32
  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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Schwartz