active_hash_relation 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/_config.yml +1 -0
- data/lib/active_hash_relation/column_filters.rb +4 -4
- data/lib/active_hash_relation/filter_applier.rb +3 -0
- data/lib/active_hash_relation/version.rb +1 -1
- data/spec/tests/numbers_spec.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a00b135d8162d8af7a2c6ae06cb0758685d966a3
|
4
|
+
data.tar.gz: bbcc1dd606649abd029ac56115debd1e1d505545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12a6921f13269ea6a38cd2c02f7315f4656c3f9321ff94a8e258dbb57af3309e83541ae436757d9e83a4d452ca3a34d74146ade783486ca476d23ef5bf64d561
|
7
|
+
data.tar.gz: c93ff9befda47f60fe7ce86f9fa287ad07c479a2d25cf2d8d842e8625045ffcce39d8831045cd7bb6c507949df1afe72e4d26755aa6d837d03b24a688f4b8db4
|
data/README.md
CHANGED
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-cayman
|
@@ -53,8 +53,8 @@ module ActiveHashRelation::ColumnFilters
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def filter_text(resource, column, param)
|
57
|
-
return filter_string(resource, column, param)
|
56
|
+
def filter_text(resource, column, table_name, param)
|
57
|
+
return filter_string(resource, column, table_name, param)
|
58
58
|
end
|
59
59
|
|
60
60
|
def filter_date(resource, column, table_name, param)
|
@@ -201,7 +201,7 @@ module ActiveHashRelation::ColumnFilters
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def null_filters(resource, table_name, column, param)
|
204
|
-
if param[:null] == true
|
204
|
+
if param[:null] == true || param[:null] == 'true' || param[:null] == 1 || param[:null] == '1'
|
205
205
|
if @is_not
|
206
206
|
resource = resource.where.not("#{table_name}.#{column} IS NULL")
|
207
207
|
else
|
@@ -209,7 +209,7 @@ module ActiveHashRelation::ColumnFilters
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
if param[:null] == false
|
212
|
+
if param[:null] == false || param[:null] == 'false' || param[:null] == 0 || param[:null] == '0'
|
213
213
|
if @is_not
|
214
214
|
resource = resource.where.not("#{table_name}.#{column} IS NOT NULL")
|
215
215
|
else
|
@@ -33,6 +33,9 @@ module ActiveHashRelation
|
|
33
33
|
|
34
34
|
case c.type
|
35
35
|
when :integer
|
36
|
+
if @model.defined_enums[c.name] && @model.defined_enums[c.name][@params[c.name]]
|
37
|
+
@params[c.name] = @model.defined_enums[c.name][@params[c.name]]
|
38
|
+
end
|
36
39
|
@resource = filter_integer(@resource, c.name, table_name, @params[c.name])
|
37
40
|
when :float
|
38
41
|
@resource = filter_float(@resource, c.name, table_name, @params[c.name])
|
data/spec/tests/numbers_spec.rb
CHANGED
@@ -137,6 +137,17 @@ describe ActiveHashRelation do
|
|
137
137
|
|
138
138
|
expect(strip(query)).to eq expected_query.to_s
|
139
139
|
end
|
140
|
+
|
141
|
+
it 'rails string enum' do
|
142
|
+
hash = {status: 'published'}
|
143
|
+
|
144
|
+
query = HelperClass.new.apply_filters(Micropost.all, hash).to_sql
|
145
|
+
expected_query = q(
|
146
|
+
"SELECT microposts.* FROM microposts WHERE (microposts.status = #{Micropost.statuses[:published]})"
|
147
|
+
)
|
148
|
+
|
149
|
+
expect(strip(query)).to eq expected_query.to_s
|
150
|
+
end
|
140
151
|
end
|
141
152
|
end
|
142
153
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_hash_relation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filippos Vasilakis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- LICENSE.txt
|
210
210
|
- README.md
|
211
211
|
- Rakefile
|
212
|
+
- _config.yml
|
212
213
|
- active_hash_relation.gemspec
|
213
214
|
- lib/active_hash_relation.rb
|
214
215
|
- lib/active_hash_relation/aggregation.rb
|
@@ -359,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
360
|
version: '0'
|
360
361
|
requirements: []
|
361
362
|
rubyforge_project:
|
362
|
-
rubygems_version: 2.6.
|
363
|
+
rubygems_version: 2.6.12
|
363
364
|
signing_key:
|
364
365
|
specification_version: 4
|
365
366
|
summary: Simple gem that allows you to run multiple ActiveRecord::Relation using hash.
|