forest_liana 1.3.25 → 1.3.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/forest_liana/schema_utils.rb +20 -1
- data/lib/forest_liana/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 975b42904599b74f622fa458dd46249b95038ba1
|
4
|
+
data.tar.gz: 4f1f037d8d3ff6f39d3d4d177f8079d4883fd8ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3341f69e8ee54758c0b695bba7f532f188fd87a44a863dcc8dbd17c9cd409e4ee04ee888c5d9c2e0ca8a0242551e6f56b9c0b8b8ee01d89c6096c28ccd1c1b58
|
7
|
+
data.tar.gz: d398d2a1e8c64eb950f8062b91aae01a22269597c1b66787e839bdd707fa8c9e1b3a836dfbda8b1f9d6b932dd2617eca7fde4e3b424c20398825407eed0825b0
|
@@ -14,7 +14,17 @@ module ForestLiana
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.find_model_from_table_name(table_name)
|
17
|
-
|
17
|
+
model = nil
|
18
|
+
|
19
|
+
ActiveRecord::Base.subclasses.each do |subclass|
|
20
|
+
if subclass.abstract_class?
|
21
|
+
model = self.find_model_from_abstract_class(subclass, table_name)
|
22
|
+
elsif subclass.table_name == table_name
|
23
|
+
model = subclass
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
model
|
18
28
|
end
|
19
29
|
|
20
30
|
def self.tables_names
|
@@ -27,6 +37,15 @@ module ForestLiana
|
|
27
37
|
association.options[:polymorphic]
|
28
38
|
end
|
29
39
|
|
40
|
+
def self.find_model_from_abstract_class(abstract_class, table_name)
|
41
|
+
abstract_class.subclasses.find do |subclass|
|
42
|
+
if subclass.abstract_class?
|
43
|
+
return self.find_model_from_table_name(subclass, table_name)
|
44
|
+
else
|
45
|
+
subclass.table_name == table_name
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
30
49
|
end
|
31
50
|
end
|
32
51
|
|
data/lib/forest_liana/version.rb
CHANGED