hierarchy-tree 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hierarchy_tree.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb0de6ef3ff8b267337c4b212fb79cc61882daeabdeed87f24ed8c6e2cf57a2
|
4
|
+
data.tar.gz: 2f9edaf7700263b9cb0258c3b78254d2860d5483379898ddab7a05d9eefa0d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a737550c58c67149a23afd9252bc5f357953c715b9a76274da6c6c6b599bdd5fa3a22bda025cbec8913ba48c7350d44a2fa384222533b7816fb8f385469fbd40
|
7
|
+
data.tar.gz: e2b5a61beed7165bb58e36edc90c86e27e0214fe85a27af2a2ea99cb3825c0c4916c8700b8b333d7fabf1431f0ba9eff4621f22c8afa3ec4fef4e6b4d6f9aeac
|
data/lib/hierarchy_tree.rb
CHANGED
@@ -3,9 +3,9 @@ require 'active_support/core_ext/object/inclusion.rb'
|
|
3
3
|
|
4
4
|
################ Debug ################
|
5
5
|
# gem cleanup hierarchy-tree
|
6
|
-
# rm hierarchy-tree-
|
6
|
+
# rm hierarchy-tree-X.Y.Z.gem
|
7
7
|
# gem build hierarchy_tree
|
8
|
-
# gem install hierarchy-tree-
|
8
|
+
# gem install hierarchy-tree-X.Y.Z.gem
|
9
9
|
# ruby -Itest test/test_hierarchy_tree.rb
|
10
10
|
|
11
11
|
class Hierarchy
|
@@ -41,6 +41,8 @@ class Hierarchy
|
|
41
41
|
current_path = current[:path]
|
42
42
|
|
43
43
|
current_class.constantize.reflect_on_all_associations(:belongs_to).each do |relation|
|
44
|
+
next if relation.options[:polymorphic]
|
45
|
+
|
44
46
|
next_class = relation.klass.to_s
|
45
47
|
next_path = current_path + [relation.name]
|
46
48
|
|
@@ -71,6 +73,8 @@ class Hierarchy
|
|
71
73
|
current_path = current[:path]
|
72
74
|
|
73
75
|
current_class.reflect_on_all_associations(:belongs_to).each do |relation|
|
76
|
+
next if relation.options[:polymorphic]
|
77
|
+
|
74
78
|
next_class = relation.klass
|
75
79
|
next_path = current_path + [relation.name]
|
76
80
|
|