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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e725b5df6b63eb4d44d79274df5a6e73ccbb2cc08846d07b875a904fab545ac7
4
- data.tar.gz: 6f7f5b1bc693af8de774b66c95de58f60f11dd837382b7efd49ffd525095e427
3
+ metadata.gz: 540f632db356dadd92e206ac7e8fe79dfbe0d71c78eadf7ffaf8da2d3b5c3665
4
+ data.tar.gz: 4ed49c346d01a83fdc32f2647d36f4052899bfab7dd10998f6b84c2d49d858c0
5
5
  SHA512:
6
- metadata.gz: 23d3e2bb35a38d799ceb299435dbfaaa5ab42484434855aedb9a413196e3fae5ef89da18b6dc5498bb55953d401e192a02bc2f1e53959c79d11a864503aad389
7
- data.tar.gz: eed2b359ffad18cca89a6b6a8ca8fe40706f96b6431a2df3e3fa1d3428a9d88f83f69ed14eff1858d3a77afd295dc088d1ed76a695f38a5e9d8ed87a9a019d92
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}")
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Filterable
3
- VERSION = '2.0.1'
3
+ VERSION = '2.0.2'
4
4
  end
5
5
  end
@@ -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.1
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-07-30 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler