activerecord-filter 6.1.0 → 6.1.0.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 +7 -4
- data/lib/active_record/filter.rb +4 -2
- data/lib/active_record/filter/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ee3eb761b9e63875afecd98becf6b5f6b0482937610ee0a9303cfe7d8d0b75
|
4
|
+
data.tar.gz: 85b0b14cee45da61b44326810765078ad7a838af806168950a0ee50d48b5a2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f47b5bc745550bb48c1cd6aa85642e20511b5235befe0acd123909e0faa422c2b53662a26e8db4da8ae44029b0d0ddf44fd5179e48f23ee25e3463634bc164
|
7
|
+
data.tar.gz: 2240aadf3eea6b58f1b2d16e7e0cb785e7250938538533bf33d565871a15d845f0a1ea496cdec8b520bc575c66f330953dd300eabc1d75be405c029468e19124
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# ActiveRecord::
|
1
|
+
# ActiveRecord::Filter
|
2
2
|
|
3
|
-
`ActiveRecord::
|
3
|
+
`ActiveRecord::Filter` provides and easy way to accept user input and filter a query by the input.
|
4
4
|
|
5
5
|
Installtion
|
6
6
|
-----------
|
@@ -73,6 +73,9 @@ String columns:
|
|
73
73
|
Property.filter(name: {like: 'nam%'}).to_sql
|
74
74
|
# => "... WHERE properties.name LIKE 'nam%' ..."
|
75
75
|
|
76
|
+
Property.filter(name: {ilike: 'nam%'}).to_sql
|
77
|
+
# => "... WHERE properties.name ILIKE 'nam%' ..."
|
78
|
+
|
76
79
|
Property.filter(name: {ts_match: 'name'}).to_sql
|
77
80
|
# => "... WHERE to_tsvector("properties"."name") @@ to_tsquery('name') ..."
|
78
81
|
```
|
@@ -125,6 +128,6 @@ It can also sort on relations:
|
|
125
128
|
|
126
129
|
```ruby
|
127
130
|
Photo.filter(property: {name: 'Empire State'}).to_sql
|
128
|
-
# => "...
|
131
|
+
# => "... LEFT OUTER JOIN properties ON properties.id = photos.property_id ...
|
129
132
|
# => "... WHERE properties.name = 'Empire State'"
|
130
|
-
```
|
133
|
+
```
|
data/lib/active_record/filter.rb
CHANGED
@@ -257,8 +257,10 @@ module ActiveRecord
|
|
257
257
|
attribute.lt(value)
|
258
258
|
when :less_than_or_equal_to, :lteq, :lte
|
259
259
|
attribute.lteq(value)
|
260
|
-
when :like
|
261
|
-
attribute.matches(value)
|
260
|
+
when :like
|
261
|
+
attribute.matches(value, nil, true)
|
262
|
+
when :ilike
|
263
|
+
attribute.matches(value, nil, false)
|
262
264
|
when :not, :not_equal, :neq
|
263
265
|
attribute.not_eq(value)
|
264
266
|
when :not_in
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.0
|
4
|
+
version: 6.1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.1.0
|
33
|
+
version: 6.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 6.1.0
|
40
|
+
version: 6.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pg
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|