activerecord-bixformer 0.4.4 → 0.4.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 975aa8d7deb6a1db994d840cef88a84548505449
|
4
|
+
data.tar.gz: 18b1ef10ebe9d3a1973468ff4de5899769db39e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e29358781db9fc618679e1f82816bcdfbbb91527df9a19037058f2ae0bb4007744b97151b0a9a7b76cf0d5c45e2bcfd105a81e8da246b74dfea21b45f864b68
|
7
|
+
data.tar.gz: ecc108217d93c7c574d2df66f143e45ed905abe266772ebc6f11358784625fa4dc41008652edf67e5f7ca3a2501e26f199a7ea7885710e09b492a059d8e70286
|
@@ -80,9 +80,15 @@ module ActiveRecord
|
|
80
80
|
private
|
81
81
|
|
82
82
|
def foreign_constant
|
83
|
-
@foreign_constant ||=
|
84
|
-
|
85
|
-
|
83
|
+
@foreign_constant ||= -> do
|
84
|
+
reflection = @model.activerecord_constant.reflections.values.find { |r| r.foreign_key == @name }
|
85
|
+
|
86
|
+
if reflection.respond_to?(:class_name)
|
87
|
+
reflection.class_name.constantize
|
88
|
+
else
|
89
|
+
reflection.table_name.classify.constantize
|
90
|
+
end
|
91
|
+
end.call
|
86
92
|
end
|
87
93
|
end
|
88
94
|
end
|