ransack 6.1.0 → 6.1.1
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/README.md +2 -3
- data/lib/ransack/nodes/condition.rb +3 -3
- data/lib/ransack/nodes/grouping.rb +1 -1
- data/lib/ransack/nodes/node.rb +15 -12
- data/lib/ransack/nodes/sort.rb +1 -1
- data/lib/ransack/version.rb +1 -1
- metadata +2 -8
- data/lib/ransack/invalid_search_error.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5e5f9de722c32e837eb4a964cb1eac3a122cd2bfaf11cadd9b6234ac08249c7
|
|
4
|
+
data.tar.gz: 7322a874d888c2b98229f29fc23e4e1339d6c851f046b787312feedef1b30af2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb55b6504e333b50b125288e2ef1c86d5cfdfd571a1d913dab8af18574cf76ca4265d958bea2f86c5bc9534a93707dd84e08c43cd50c7c7d28b5d6381b6cee88
|
|
7
|
+
data.tar.gz: c482f3ded58599621b46fa78d6c83ac06f9c5eccf0346243b52f8335ccc5222446716d1996444918c77ec0bfc85b95a67766a259fc5aa9637739b5ae86a71454
|
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Ransack adds **searching and sorting to your Rails application** with plain Ruby
|
|
9
9
|
and ERB, without a search server or any other infrastructure.
|
|
10
10
|
|
|
11
|
-
Ransack is supported for Rails 8.1 on Ruby 3.
|
|
11
|
+
Ransack is supported for Rails 8.1 on Ruby 3.3 and later, on Postgres, MySQL, Trilogy and SQLite.
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
14
|
gem 'ransack'
|
|
@@ -53,8 +53,7 @@ for commercial support.
|
|
|
53
53
|
## Contributors
|
|
54
54
|
|
|
55
55
|
Ransack is maintained by [Sean Carroll](https://github.com/scarroll32),
|
|
56
|
-
[Deivid Rodriguez](https://github.com/deivid-rodriguez)
|
|
57
|
-
[Greg Molnar](https://github.com/gregmolnar) and
|
|
56
|
+
[Deivid Rodriguez](https://github.com/deivid-rodriguez) and
|
|
58
57
|
[a great group of contributors](https://github.com/activerecord-hackery/ransack/graphs/contributors).
|
|
59
58
|
It was created by [Ernie Miller](http://twitter.com/erniemiller). See
|
|
60
59
|
[Community and support](https://activerecord-hackery.github.io/ransack/project/community/)
|
|
@@ -136,7 +136,7 @@ module Ransack
|
|
|
136
136
|
end
|
|
137
137
|
when Hash
|
|
138
138
|
args.each do |index, attrs|
|
|
139
|
-
attrs = indifferent_params(attrs, 'attribute')
|
|
139
|
+
attrs = indifferent_params(attrs, 'an attribute')
|
|
140
140
|
build_attributes(attrs[:name], attrs[:ransacker_args])
|
|
141
141
|
end
|
|
142
142
|
else
|
|
@@ -162,7 +162,7 @@ module Ransack
|
|
|
162
162
|
end
|
|
163
163
|
when Hash
|
|
164
164
|
args.each do |index, attrs|
|
|
165
|
-
val = Value.new(@context, indifferent_params(attrs, 'value')[:value])
|
|
165
|
+
val = Value.new(@context, indifferent_params(attrs, 'a value')[:value])
|
|
166
166
|
self.values << val
|
|
167
167
|
end
|
|
168
168
|
else
|
|
@@ -274,7 +274,7 @@ module Ransack
|
|
|
274
274
|
}.freeze
|
|
275
275
|
|
|
276
276
|
def build(params)
|
|
277
|
-
indifferent_params(params, 'condition').each do |key, value|
|
|
277
|
+
indifferent_params(params, 'a condition').each do |key, value|
|
|
278
278
|
if key.match(/\A(a|v|p|m|attributes|values|predicate|predicate_name|combinator)\z/)
|
|
279
279
|
self.send("#{LONG_KEYS.fetch(key, key)}=", value)
|
|
280
280
|
end
|
|
@@ -147,7 +147,7 @@ module Ransack
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def build(params)
|
|
150
|
-
indifferent_params(params, 'grouping').each do |key, value|
|
|
150
|
+
indifferent_params(params, 'a grouping').each do |key, value|
|
|
151
151
|
case key
|
|
152
152
|
when /\A(g|c|m|groupings|conditions|combinator)\z/
|
|
153
153
|
self.send("#{key}=", value)
|
data/lib/ransack/nodes/node.rb
CHANGED
|
@@ -47,23 +47,26 @@ module Ransack
|
|
|
47
47
|
# Search params usually come from the request, so a grouping, condition
|
|
48
48
|
# or sort given as something other than a hash (`q[g]=x`) is a malformed
|
|
49
49
|
# search, not a programming error, whether or not the search is strict.
|
|
50
|
+
# Strong parameters are unwrapped as `Search#initialize` unwraps them, so
|
|
51
|
+
# `build_grouping(params[:g])` takes what `ransack(params[:q])` does. That
|
|
52
|
+
# does not make the search permitted: only `Search#initialize` reads it.
|
|
50
53
|
def indifferent_params(params, node_name)
|
|
54
|
+
params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
|
|
51
55
|
return params.with_indifferent_access if params.respond_to?(:with_indifferent_access)
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
57
|
+
raise InvalidSearchError,
|
|
58
|
+
"Invalid argument (#{params.class}) supplied for #{node_name}"
|
|
59
|
+
end
|
|
56
60
|
|
|
57
|
-
# A name, predicate, direction or combinator is a single value. Given an
|
|
58
|
-
# array or a hash (`q[s][0][dir][]=desc`), it used to be stringified and
|
|
59
|
-
# then silently ignored or defaulted, so the search ran as something
|
|
60
|
-
# other than what was asked for.
|
|
61
|
-
def scalar_param(value, field)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
raise InvalidSearchError, "Invalid argument (#{value.class}) supplied for #{field}"
|
|
65
|
-
end
|
|
61
|
+
# A name, predicate, direction or combinator is a single value. Given an
|
|
62
|
+
# array or a hash (`q[s][0][dir][]=desc`), it used to be stringified and
|
|
63
|
+
# then silently ignored or defaulted, so the search ran as something
|
|
64
|
+
# other than what was asked for.
|
|
65
|
+
def scalar_param(value, field)
|
|
66
|
+
return value unless value.is_a?(Enumerable) || value.respond_to?(:to_unsafe_h)
|
|
66
67
|
|
|
68
|
+
raise InvalidSearchError, "Invalid argument (#{value.class}) supplied for #{field}"
|
|
69
|
+
end
|
|
67
70
|
end
|
|
68
71
|
end
|
|
69
72
|
end
|
data/lib/ransack/nodes/sort.rb
CHANGED
data/lib/ransack/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ransack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.1.
|
|
4
|
+
version: 6.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Ernie Miller
|
|
8
|
-
- Ryan Bigg
|
|
9
|
-
- Jon Atack
|
|
10
7
|
- Sean Carroll
|
|
11
8
|
- David Rodríguez
|
|
9
|
+
- Ernie Miller
|
|
12
10
|
bindir: bin
|
|
13
11
|
cert_chain: []
|
|
14
12
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -59,9 +57,6 @@ description: Powerful object-based searching and filtering for Active Record wit
|
|
|
59
57
|
advanced features like complex boolean queries, association searching, custom predicates
|
|
60
58
|
and i18n support.
|
|
61
59
|
email:
|
|
62
|
-
- ernie@erniemiller.org
|
|
63
|
-
- radarlistener@gmail.com
|
|
64
|
-
- jonnyatack@gmail.com
|
|
65
60
|
- sean@immersive-app.com
|
|
66
61
|
executables: []
|
|
67
62
|
extensions: []
|
|
@@ -86,7 +81,6 @@ files:
|
|
|
86
81
|
- lib/ransack/helpers.rb
|
|
87
82
|
- lib/ransack/helpers/form_builder.rb
|
|
88
83
|
- lib/ransack/helpers/form_helper.rb
|
|
89
|
-
- lib/ransack/invalid_search_error.rb
|
|
90
84
|
- lib/ransack/locale/ar.yml
|
|
91
85
|
- lib/ransack/locale/az.yml
|
|
92
86
|
- lib/ransack/locale/bg.yml
|