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 +4 -4
- data/lib/databound/manager.rb +6 -9
- data/lib/databound/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f3852879063203ff4dcb3b65edd71d060cf72c7
|
4
|
+
data.tar.gz: 1b6f3ac813291d0ef28492b100ac5a264415d745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9c65b00740ada50f4a998a12cc91f58e81fdd745ff3bef8181c52a05f1c13fb68b3f343c9bae4fccfaeb0b1ddd24bc11d109cebd7da83be87ea1f6217e02e4
|
7
|
+
data.tar.gz: 4a0a8d40e64182fe98c784b0def718bd6d9812bf945c8568532e4ee1fedc8da51a56d7c4795e1ab454ca435b6eac21b59d3e1269070c00f1742d015d72f45f24
|
data/lib/databound/manager.rb
CHANGED
@@ -15,7 +15,7 @@ module Databound
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def find_scoped_records(only_extra_scopes: false)
|
18
|
-
records =
|
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
|
-
|
71
|
-
|
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
|
-
|
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
|
169
|
+
records & or_query(params, *@extra_where_scopes)
|
173
170
|
end
|
174
171
|
end
|
175
172
|
end
|
data/lib/databound/version.rb
CHANGED