docs/docs/getting-started/simple-mode.md in ransack-3.2.1 vs docs/docs/getting-started/simple-mode.md in ransack-4.0.0
- old
+ new
@@ -25,10 +25,14 @@
@q = Person.ransack(params[:q])
@people = @q.result.includes(:articles).page(params[:page])
end
```
+:::caution
+By default, searching and sorting are authorized on any column of your model. See [Authorization (allowlisting/denylisting)](/going-further/other-notes.md#authorization-allowlistingdenylisting) on how to prevent this.
+:::
+
### Default search options
#### Search parameter
Ransack uses a default `:q` param key for search params. This may be changed by
@@ -48,20 +52,20 @@
After version 2.4.0 when searching a string query Ransack by default strips all whitespace around the query string.
This may be disabled by setting the `strip_whitespace` option in a Ransack initializer file:
```ruby
Ransack.configure do |c|
- # Change whitespace stripping behaviour.
+ # Change whitespace stripping behavior.
# Default is true
c.strip_whitespace = false
end
```
## In your view
The two primary Ransack view helpers are `search_form_for` and `sort_link`,
which are defined in
-[Ransack::Helpers::FormHelper](https://github.com/activerecord-hackery/ransack/lib/ransack/helpers/form_helper.rb).
+[Ransack::Helpers::FormHelper](https://github.com/activerecord-hackery/ransack/blob/main/lib/ransack/helpers/form_helper.rb).
### Form helper
Ransack's `search_form_for` helper replaces `form_for` for creating the view search form