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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ba8d3aaed9463815f83717410dabf1d47fd2959
4
- data.tar.gz: 14e4eea13e73d7f60ada9f9313a0739e3311fb0f
3
+ metadata.gz: a00b135d8162d8af7a2c6ae06cb0758685d966a3
4
+ data.tar.gz: bbcc1dd606649abd029ac56115debd1e1d505545
5
5
  SHA512:
6
- metadata.gz: 608d20958f7fd3f37e121abbe57c7c4aa546af10112edcd27e47cbc05f0e702139e6cc23e3bced226c7af8eee354d886b779ffb7c7cd385b639d063c7609ad35
7
- data.tar.gz: ebfd652d954d006b0fc13eb4b4b146f95dce213821d52a78f661f7b1a5a80f2a3a9f6723893c5440fae771526bbf45afb36348b47b8d329ef1b0f24db1c781d4
6
+ metadata.gz: 12a6921f13269ea6a38cd2c02f7315f4656c3f9321ff94a8e258dbb57af3309e83541ae436757d9e83a4d452ca3a34d74146ade783486ca476d23ef5bf64d561
7
+ data.tar.gz: c93ff9befda47f60fe7ce86f9fa287ad07c479a2d25cf2d8d842e8625045ffcce39d8831045cd7bb6c507949df1afe72e4d26755aa6d837d03b24a688f4b8db4
data/README.md CHANGED
@@ -32,7 +32,7 @@ which might or might not be a security issue. If you don't like that check you c
32
32
 
33
33
  Add this line to your application's Gemfile:
34
34
 
35
- gem 'active_hash_relation', '~> 1.3.0
35
+ gem 'active_hash_relation', '~> 1.4.1'
36
36
 
37
37
  And then execute:
38
38
 
@@ -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])
@@ -1,3 +1,3 @@
1
1
  module ActiveHashRelation
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
@@ -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.0
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: 2017-02-12 00:00:00.000000000 Z
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.8
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.