activerecord-bixformer 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/activerecord-bixformer/model/base.rb +25 -0
- data/lib/activerecord-bixformer/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: 303e261f090fa8713c3e71b94c045cb6d0474d00
|
4
|
+
data.tar.gz: 31afcfb71cff5db5ba0a7e8c1bf389689004e27b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3aa286b5a07a5474ceff4c262e65d832485be01c54bf0208812d161a110bbe3bd1dc8f2ef68bf1ca91cc9b466ebec7c5dcff02d4a6001b89d8b4f5a6b760f27
|
7
|
+
data.tar.gz: f122afb62d6c8ce9cf7eb008b5d6126f23150facb9826f7b328f318d59052c4712e2bda677df4a091206fa9706443fe2b79452400a26ca17e10ae01441c3089c
|
@@ -81,6 +81,31 @@ module ActiveRecord
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
def should_be_included
|
85
|
+
arr = []
|
86
|
+
hash = {}
|
87
|
+
|
88
|
+
@associations.each do |assoc|
|
89
|
+
assoc_should_be_included = assoc.should_be_included
|
90
|
+
|
91
|
+
if assoc_should_be_included.empty?
|
92
|
+
arr.push assoc.name.to_sym
|
93
|
+
else
|
94
|
+
hash[assoc.name.to_sym] = assoc_should_be_included
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if hash.empty? && arr.empty?
|
99
|
+
[]
|
100
|
+
elsif hash.empty?
|
101
|
+
arr
|
102
|
+
elsif arr.empty?
|
103
|
+
hash
|
104
|
+
else
|
105
|
+
[*arr, hash]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
84
109
|
def find_record_by!(condition)
|
85
110
|
activerecord_constant.find_by!(condition)
|
86
111
|
end
|