recordselect 3.7.3 → 3.7.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/record_select/conditions.rb +15 -3
- data/lib/record_select/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efe958e87d0f785d2de5cb9a4f2d46d8f241e865
|
|
4
|
+
data.tar.gz: d1ddeb4afea9a41c117f9e0a8c2be8d5aa387a81
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67ba0a22e93a38450dc1d5891f6fdbaa25b73f2a8739ce603a89efd26a14739c2e3782d52f3c8f07062510723ac4aea4bc744362764815da47710c3e947e4571
|
|
7
|
+
data.tar.gz: d73fc94553c7ca598ebfbb109997f3958fdee48ecb302c79864a98469ab1437b2a941c575b189d4bd0518d900341570715bdbe7045e0ac802df8ea85b829722d
|
|
@@ -70,7 +70,19 @@ module RecordSelect
|
|
|
70
70
|
conditions
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
def record_select_type_cast(column, value)
|
|
74
|
+
if Rails.version < '4.2'
|
|
75
|
+
column.type_cast value
|
|
76
|
+
elsif Rails.version < '5.0'
|
|
77
|
+
column.type_cast_from_user value
|
|
78
|
+
elsif column.type.respond_to? :cast # jruby-jdbc and rails 5
|
|
79
|
+
column.type.cast value
|
|
80
|
+
else
|
|
81
|
+
cast_type = ActiveModel::Type.lookup column.type
|
|
82
|
+
cast_type ? cast_type.cast(value) : value
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
74
86
|
# generates an SQL condition for the given column/value
|
|
75
87
|
def record_select_condition_for_column(column, value)
|
|
76
88
|
model = record_select_config.model
|
|
@@ -79,10 +91,10 @@ module RecordSelect
|
|
|
79
91
|
{column.name => value}
|
|
80
92
|
elsif value.blank? and column.null
|
|
81
93
|
"#{column_name} IS NULL"
|
|
82
|
-
elsif column.
|
|
94
|
+
elsif [:string, :text].include? column.type
|
|
83
95
|
["LOWER(#{column_name}) LIKE ?", value]
|
|
84
96
|
else
|
|
85
|
-
["#{column_name} = ?", column
|
|
97
|
+
["#{column_name} = ?", record_select_type_cast(column, value)]
|
|
86
98
|
end
|
|
87
99
|
end
|
|
88
100
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: recordselect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.7.
|
|
4
|
+
version: 3.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergio Cambra
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-06-
|
|
13
|
+
date: 2017-06-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|