activerecord-bixformer 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e07760f320a0cfdfc606124616f62f5085cd9a66
4
- data.tar.gz: 976bbd889da827467283740dead4eeb6bed7b9fb
3
+ metadata.gz: 303e261f090fa8713c3e71b94c045cb6d0474d00
4
+ data.tar.gz: 31afcfb71cff5db5ba0a7e8c1bf389689004e27b
5
5
  SHA512:
6
- metadata.gz: 7935499df28d4d7beb4d1d8a0b4bc97ef8b6f91244f9f8ebda7862c9fedfe83213e35d850c92d9ead5d5e574e00c97774a5acd9beef9a6c2032d0e459607a51a
7
- data.tar.gz: 43ab80022d46e4e9f85a8bb5076daf935901435893b1d66af27380456061e187af2218f720510e86d77fe93fc0ee3901e10e915f39a83d7f2b70a854f849fdd1
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
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bixformer
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bixformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Otsu