auto_define_scope 0.1.5 → 0.1.6
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeeee9436fd2fd06c0755f63ed0425d9c3259a18e241647475b75c1eef5b32c5
|
4
|
+
data.tar.gz: 2d78c952dd6e2ef6e1bc3ee87212321fb8a6cc0c7250fe842904a22ba93364f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f966ec588e3d48fbad647a3be736e842df9d89e54d87428ec05d025ad7efe63b6f98703f48f5bd063c7f91a54780c46d18b62a622452c6ed98e31b464f16f4
|
7
|
+
data.tar.gz: 6dc5b55b6f1382f2dbaa71f01faccc3be0edad45f02572948e5e8f803cb2dddf0e226e71e3305cb48e2ada97d8d164dc7658817dc466ec5b60cf2ca0500ca6f3
|
@@ -46,7 +46,7 @@ module AutoDefineScope
|
|
46
46
|
next
|
47
47
|
end
|
48
48
|
column_type = columns_hash[c.to_s]&.type
|
49
|
-
raise "scopes defined error, not found column('#{c}') for table #{klass.table_name}" if
|
49
|
+
raise "scopes defined error, not found column('#{c}') for table #{klass.table_name}" if column_type.nil?
|
50
50
|
joins_params = joins_params_array.reverse.inject() { |a, n| { n => a } }
|
51
51
|
table_name = klass.table_name
|
52
52
|
@auto_define_scopes ||= []
|
@@ -58,6 +58,8 @@ module AutoDefineScope
|
|
58
58
|
value.to_i
|
59
59
|
when :string
|
60
60
|
value.to_s
|
61
|
+
else
|
62
|
+
value
|
61
63
|
end
|
62
64
|
value = type == :with ? value : "%#{value}%"
|
63
65
|
joins(joins_params).where("#{table_name}.#{c} #{OPERATE_SQL[type]}", value)
|