databound 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 045bfebd7dbcfd1235c613b720a00734ea7f7db6
4
- data.tar.gz: 82a32802692b1a40059cd541e3c80d217394de67
3
+ metadata.gz: 2f3852879063203ff4dcb3b65edd71d060cf72c7
4
+ data.tar.gz: 1b6f3ac813291d0ef28492b100ac5a264415d745
5
5
  SHA512:
6
- metadata.gz: 37887b99be8b2b5fb91d4248bdabacad1ab0b6053c0967fd54bfdd9c35e7411a49c5ff701bb47e86fe879811df1e7f461f3d93da06d87bea180138c3ff29ddd9
7
- data.tar.gz: 373c67bbfb09bcb578281cbe5c2bff7de53c2e6de57d6d501726f3fd6e4a7cc32d7dd3f850d67d1ee64e7f27f9c69c8cad3427b55b85dc97f90c60edcda541fc
6
+ metadata.gz: ec9c65b00740ada50f4a998a12cc91f58e81fdd745ff3bef8181c52a05f1c13fb68b3f343c9bae4fccfaeb0b1ddd24bc11d109cebd7da83be87ea1f6217e02e4
7
+ data.tar.gz: 4a0a8d40e64182fe98c784b0def718bd6d9812bf945c8568532e4ee1fedc8da51a56d7c4795e1ab454ca435b6eac21b59d3e1269070c00f1742d015d72f45f24
@@ -15,7 +15,7 @@ module Databound
15
15
  end
16
16
 
17
17
  def find_scoped_records(only_extra_scopes: false)
18
- records = model.where(or_query(@scope, *@extra_where_scopes))
18
+ records = or_query(@scope, *@extra_where_scopes)
19
19
 
20
20
  unless only_extra_scopes
21
21
  records = filter_by_params!(records)
@@ -67,18 +67,15 @@ module Databound
67
67
  model.where(scope.to_h).where_values.reduce(:and)
68
68
  end
69
69
 
70
- left_query = nodes.reduce(:or)
71
- return unless left_query
72
-
73
- [left_query.to_sql, *bound_values(scopes)]
70
+ model.where(nodes.reduce(:or)).tap do |q|
71
+ q.bind_values = bound_values(scopes)
72
+ end
74
73
  end
75
74
 
76
75
  def bound_values(scopes)
77
- values = scopes.flat_map do |scope|
76
+ scopes.flat_map do |scope|
78
77
  model.where(scope.to_h).bind_values
79
78
  end
80
-
81
- values.map(&:last)
82
79
  end
83
80
 
84
81
  def check_params!(action)
@@ -169,7 +166,7 @@ module Databound
169
166
  end
170
167
 
171
168
  def filter_by_params!(records)
172
- records.where(or_query(params, *@extra_where_scopes))
169
+ records & or_query(params, *@extra_where_scopes)
173
170
  end
174
171
  end
175
172
  end
@@ -1,3 +1,3 @@
1
1
  module Databound
2
- VERSION = '3.1.2'
2
+ VERSION = '3.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databound
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domas Bitvinskas