mongoid-filterable 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid-filterable/filterable.rb +2 -1
- data/lib/mongoid-filterable/version.rb +1 -1
- data/spec/filterable_spec.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 540f632db356dadd92e206ac7e8fe79dfbe0d71c78eadf7ffaf8da2d3b5c3665
|
4
|
+
data.tar.gz: 4ed49c346d01a83fdc32f2647d36f4052899bfab7dd10998f6b84c2d49d858c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c0e27e18b32e0f51d6c8b2fba9a6859ba7ba83e5efe3cbbd30f93bc117fba7c1bf32d66955377fc4714b8def4106256b024c1f672db9bb02adcc7a75c59571a
|
7
|
+
data.tar.gz: c3750a2aad2e8b8ce2d8820347eaa4c8a0ad7eebf81e2bffd2433da81d7b60938498bc80f533f0336dc9beb50f2ed2d99d1e6c7437749d884d4c8e12c5f44964
|
@@ -9,9 +9,10 @@ module Mongoid
|
|
9
9
|
#
|
10
10
|
def filtrate(filtering_params, operator='$and')
|
11
11
|
return all unless filtering_params
|
12
|
+
|
12
13
|
results = all
|
13
14
|
selectors = []
|
14
|
-
criteria = unscoped
|
15
|
+
criteria = Mongoid::Criteria.new(self).unscoped
|
15
16
|
|
16
17
|
filtering_params.each do |key, value|
|
17
18
|
if respond_to?("filter_with_#{key}")
|
data/spec/filterable_spec.rb
CHANGED
@@ -34,6 +34,9 @@ describe Mongoid::Filterable do
|
|
34
34
|
expect(City.filtrate(code: :code1).selector).to eq(
|
35
35
|
'active' => true, '$and' => [{'code' => :code1}]
|
36
36
|
)
|
37
|
+
expect(City.unscoped.where(active: true).filtrate(code: :code1).selector).to eq(
|
38
|
+
'active' => true, '$and' => [{'code' => :code1}]
|
39
|
+
)
|
37
40
|
end
|
38
41
|
|
39
42
|
it 'should filter by default filter' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-filterable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Jurado
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|