ransack 3.2.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql.yml +72 -0
  3. data/.github/workflows/test.yml +6 -8
  4. data/.rubocop.yml +3 -0
  5. data/CHANGELOG.md +51 -0
  6. data/CONTRIBUTING.md +33 -11
  7. data/Gemfile +9 -9
  8. data/README.md +4 -9
  9. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +4 -0
  10. data/docs/docs/getting-started/advanced-mode.md +1 -1
  11. data/docs/docs/getting-started/search-matches.md +1 -1
  12. data/docs/docs/getting-started/simple-mode.md +6 -2
  13. data/docs/docs/going-further/acts-as-taggable-on.md +4 -4
  14. data/docs/docs/going-further/form-customisation.md +1 -1
  15. data/docs/docs/going-further/i18n.md +3 -3
  16. data/docs/docs/going-further/other-notes.md +1 -1
  17. data/docs/docs/going-further/saving-queries.md +1 -1
  18. data/docs/docs/going-further/searching-postgres.md +1 -1
  19. data/docs/package.json +7 -3
  20. data/docs/yarn.lock +2255 -1901
  21. data/lib/ransack/{adapters/active_record.rb → active_record.rb} +0 -0
  22. data/lib/ransack/adapters/active_record/base.rb +78 -7
  23. data/lib/ransack/configuration.rb +25 -12
  24. data/lib/ransack/constants.rb +125 -0
  25. data/lib/ransack/context.rb +34 -5
  26. data/lib/ransack/helpers/form_builder.rb +3 -3
  27. data/lib/ransack/helpers/form_helper.rb +3 -2
  28. data/lib/ransack/nodes/attribute.rb +2 -2
  29. data/lib/ransack/nodes/condition.rb +80 -7
  30. data/lib/ransack/nodes/grouping.rb +3 -3
  31. data/lib/ransack/nodes/node.rb +1 -1
  32. data/lib/ransack/nodes/value.rb +1 -1
  33. data/lib/ransack/predicate.rb +1 -1
  34. data/lib/ransack/ransacker.rb +1 -1
  35. data/lib/ransack/search.rb +9 -4
  36. data/lib/ransack/translate.rb +2 -2
  37. data/lib/ransack/version.rb +1 -1
  38. data/lib/ransack/visitor.rb +38 -2
  39. data/lib/ransack.rb +3 -6
  40. data/spec/ransack/adapters/active_record/base_spec.rb +73 -0
  41. data/spec/ransack/configuration_spec.rb +9 -9
  42. data/spec/ransack/helpers/form_builder_spec.rb +8 -8
  43. data/spec/ransack/helpers/form_helper_spec.rb +36 -2
  44. data/spec/ransack/nodes/condition_spec.rb +24 -0
  45. data/spec/ransack/predicate_spec.rb +36 -1
  46. data/spec/ransack/translate_spec.rb +1 -1
  47. data/spec/support/schema.rb +27 -10
  48. metadata +5 -12
  49. data/lib/polyamorous.rb +0 -1
  50. data/lib/ransack/adapters/active_record/ransack/constants.rb +0 -128
  51. data/lib/ransack/adapters/active_record/ransack/context.rb +0 -56
  52. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +0 -61
  53. data/lib/ransack/adapters/active_record/ransack/translate.rb +0 -8
  54. data/lib/ransack/adapters/active_record/ransack/visitor.rb +0 -47
  55. data/lib/ransack/adapters.rb +0 -64
  56. data/lib/ransack/nodes.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ce966153aee54a3e24eb4ec775569926813ed7273839e5d042dbbc6b3addf8
4
- data.tar.gz: 4d96b0ecae077f0096494a99f90e8cfb3555140fe194c79ed691b2760319e51c
3
+ metadata.gz: 39e79c778f9eacf124a0ae2465c586d016b8fc6dd934b889d9e7ac9ede798ea7
4
+ data.tar.gz: 45c34ad5656bd01fd03e9240cf60f7419c662ad0b9aba3a1340ae701844612db
5
5
  SHA512:
6
- metadata.gz: 5d23fb2ddc8ef40489c40e02202b3d051305252c21b5f6c2823478442ce326990b22a26ee46861212b690ada0632328ce6c5065cba238bd185eecc46fd5555c5
7
- data.tar.gz: 5dffd2910eefdfe2633d13a4b7d36838340f45fb484f025fed264e5df5b69c730df16257f11e7425a0852f99255b1f22e970c6407a9f5f4c59c2ca027f6e8804
6
+ metadata.gz: 7f8b2e4b1f4adaa8d1871879364d836c8a59fbc1b7342857a4d18c7406dd074d2b000380960e1b56555548968c866a109f7600090dc93cc533bc12b7cc52b6aa
7
+ data.tar.gz: 6b7c84bccd3ba55de586bb2ff58c5a95da5062e4c2046d00065289260af32a5b1991b21d7acad28f7d1e20cb75cde526126f7bef7f0296fead10395b95849af0
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ main ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ main ]
20
+ schedule:
21
+ - cron: '43 11 * * 3'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+
56
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
+ # If this step fails, then you should remove it and run the build manually (see below)
58
+ - name: Autobuild
59
+ uses: github/codeql-action/autobuild@v2
60
+
61
+ # ℹ️ Command-line programs to run using the OS shell.
62
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
+
64
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
65
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
+
67
+ # - run: |
68
+ # echo "Run, Build Application using script"
69
+ # ./location_of_script_within_repo/buildscript.sh
70
+
71
+ - name: Perform CodeQL Analysis
72
+ uses: github/codeql-action/analyze@v2
@@ -2,6 +2,8 @@ name: test
2
2
 
3
3
  on:
4
4
  push:
5
+ branches:
6
+ - main
5
7
  pull_request:
6
8
 
7
9
  jobs:
@@ -26,8 +28,7 @@ jobs:
26
28
  uses: ruby/setup-ruby@v1
27
29
  with:
28
30
  ruby-version: ${{ matrix.ruby }}
29
- - name: Install dependencies
30
- run: bundle install
31
+ bundler-cache: true
31
32
  - name: Run tests
32
33
  run: bundle exec rspec
33
34
 
@@ -54,6 +55,7 @@ jobs:
54
55
  uses: ruby/setup-ruby@v1
55
56
  with:
56
57
  ruby-version: ${{ matrix.ruby }}
58
+ bundler-cache: true
57
59
  - name: Startup MySQL
58
60
  run: |
59
61
  sudo systemctl start mysql.service
@@ -61,8 +63,6 @@ jobs:
61
63
  run: |
62
64
  mysql --user=root --password=root --host=127.0.0.1 -e 'create database ransack collate utf8_general_ci;';
63
65
  mysql --user=root --password=root --host=127.0.0.1 -e 'use ransack;show variables like "%character%";show variables like "%collation%";';
64
- - name: Install dependencies
65
- run: bundle install
66
66
  - name: Run tests
67
67
  run: bundle exec rspec
68
68
 
@@ -105,11 +105,10 @@ jobs:
105
105
  uses: ruby/setup-ruby@v1
106
106
  with:
107
107
  ruby-version: ${{ matrix.ruby }}
108
+ bundler-cache: true
108
109
  - name: Setup databases
109
110
  run: |
110
111
  psql -h localhost -p 5432 -W postgres -c 'create database ransack;' -U postgres;
111
- - name: Install dependencies
112
- run: bundle install
113
112
  - name: Run tests
114
113
  run: bundle exec rspec
115
114
 
@@ -121,8 +120,7 @@ jobs:
121
120
  uses: ruby/setup-ruby@v1
122
121
  with:
123
122
  ruby-version: 3.1.2
124
- - name: Install dependencies
125
- run: bundle install
123
+ bundler-cache: true
126
124
  - name: Run bug report templates
127
125
  run: |
128
126
  ruby bug_report_templates/test-ransacker-arel-present-predicate.rb
data/.rubocop.yml CHANGED
@@ -30,6 +30,9 @@ Layout/SpaceInsideParens:
30
30
  Layout/TrailingEmptyLines:
31
31
  Enabled: true
32
32
 
33
+ Style/HashSyntax:
34
+ Enabled: true
35
+
33
36
  Style/RedundantFileExtensionInRequire:
34
37
  Enabled: true
35
38
 
data/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.0.0 - 2023-02-09
6
+
7
+ ### 💥 Breaking Changes
8
+
9
+ * **[SECURITY]** Require explict allowlisting of attributes and associations by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1400
10
+ * Remove Polyamorous entrypoint by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1370
11
+ * Remove dead MongoDB code by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1345
12
+
13
+ ### 🚀 Features
14
+
15
+ * Add support for default predicates by @p8 in https://github.com/activerecord-hackery/ransack/pull/1384
16
+
17
+ ### 🐛 Bug Fixes
18
+
19
+ * Ignore `ActiveModel::RangeError` in Ransack conditions by @JunichiIto in https://github.com/activerecord-hackery/ransack/pull/1340
20
+ * Fix crash when using `q=string` as parameter by @stereobooster in https://github.com/activerecord-hackery/ransack/pull/1374
21
+ * Prevent changing host through params by @AndersGM in https://github.com/activerecord-hackery/ransack/pull/1391
22
+
23
+ ### 📝 Documentation
24
+
25
+ * Fix broken documentation link by @cpgo in https://github.com/activerecord-hackery/ransack/pull/1332
26
+ * Remove more old wiki references by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1333
27
+ * Improve some wording and correct some typos by @ydah in https://github.com/activerecord-hackery/ransack/pull/1336
28
+ * Add warning about necessary authorization by @AmShaegar13 in https://github.com/activerecord-hackery/ransack/pull/1367
29
+ * Fix required Ruby and Rails version in README by @tagliala in https://github.com/activerecord-hackery/ransack/pull/1389
30
+
31
+ ### 💅 Polish
32
+
33
+ * Implement CodeQL by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1334
34
+ * Code quality improvements by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1371
35
+ * Refactor adapters by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1348
36
+ * Fix typo: teh -> the by @jdufresne in https://github.com/activerecord-hackery/ransack/pull/1387
37
+ * Fix broken link by @maful in https://github.com/activerecord-hackery/ransack/pull/1394
38
+
39
+ ### 🏠 Internal
40
+
41
+ * Bump docusaurus by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1338
42
+ * Update dependencies by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1342
43
+ * Improve CI by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1351
44
+ * Improve CONTRIBUTING.md by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1347
45
+ * Add links to GitHub Discussions by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1353
46
+ * Bump terser from 5.14.0 to 5.14.2 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1355
47
+ * Bump loader-utils from 2.0.2 to 2.0.3 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1372
48
+ * Bump loader-utils from 2.0.3 to 2.0.4 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1378
49
+ * Upgrade some documentation dependencies by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1379
50
+ * Upgrade local search plugin too by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1380
51
+ * Bump json5 from 2.2.1 to 2.2.3 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1390
52
+ * Bump ua-parser-js from 0.7.31 to 0.7.33 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1397
53
+ * Bump some doc deps by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1398
54
+ * Bump http-cache-semantics from 4.1.0 to 4.1.1 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1401
55
+
5
56
  ## 3.2.1 - 2022-05-24
6
57
 
7
58
  * Add search functionality to documentation site.
data/CONTRIBUTING.md CHANGED
@@ -69,31 +69,51 @@ Here's a quick guide:
69
69
  4. Begin by running the tests. We only take pull requests with passing tests,
70
70
  and it's great to know that you have a clean slate:
71
71
 
72
- $ bundle exec rake spec
72
+ ```sh
73
+ bundle exec rake spec
74
+ ```
73
75
 
74
76
  The test suite runs by default with SQLite3. To run the test suite with PostgreSQL or MySQL, use:
75
77
 
76
- $ DB=pg bundle exec rake spec (`DB=postgres` & `DB=postgresql` work too)
77
- $ DB=mysql bundle exec rake spec
78
+ ```sh
79
+ DB=pg bundle exec rake spec
80
+ DB=mysql bundle exec rake spec
81
+ ```
82
+
83
+ A one-liner to run all three
84
+
85
+ ```sh
86
+ bundle exec rake spec && DB=pg bundle exec rake spec && DB=mysql bundle exec rake spec
87
+ ```
78
88
 
79
89
  For Postgres and MySQL, databases are expected to exist, called 'ransack'. To create use these commands (assuming OS X and Homebrew):
80
90
 
81
91
  ### Postgres
82
- $ createdb ransack
92
+
93
+ ```sh
94
+ createdb ransack
95
+ ```
83
96
 
84
97
  ### MySQL
85
- $ mysql -u root
86
- mysql> create database ransack;
98
+
99
+ ```sh
100
+ mysql -u root
101
+ mysql> create database ransack;
102
+ ```
87
103
 
88
104
  The test suite runs by default
89
105
 
90
106
  To run only the tests in a particular file: `bundle exec rspec <path/to/filename>`
91
107
 
92
- $ bundle exec rspec spec/ransack/search_spec.rb
108
+ ```sh
109
+ bundle exec rspec spec/ransack/search_spec.rb
110
+ ```
93
111
 
94
112
  To run a single test in that file: `bundle exec rspec <path/to/filename> -e "test name"`
95
113
 
96
- $ bundle exec rspec spec/ransack/search_spec.rb -e "accepts a context option"
114
+ ```sh
115
+ bundle exec rspec spec/ransack/search_spec.rb -e "accepts a context option"
116
+ ```
97
117
 
98
118
  5. Hack away! Please use Ruby features that are compatible down to Ruby 2.3.
99
119
  Since version 2.3.1, Ransack no longer maintains Ruby 2.2 compatibility.
@@ -109,8 +129,10 @@ Here's a quick guide:
109
129
 
110
130
  9. Make sure git knows your name and email address in your `~/.gitconfig` file:
111
131
 
112
- $ git config --global user.name "Your Name"
113
- $ git config --global user.email "contributor@example.com"
132
+ ```sh
133
+ git config --global user.name "Your Name"
134
+ git config --global user.email "contributor@example.com"
135
+ ```
114
136
 
115
137
  10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
116
138
  If your pull request only contains documentation changes, please remember
@@ -132,7 +154,7 @@ day). We may suggest some changes or improvements or alternatives.
132
154
  Some things that will increase the chance that your pull request is accepted:
133
155
 
134
156
  * Include tests that fail without your code, and pass with it.
135
- * Update the README, the change log, the wiki documentation... anything that is
157
+ * Update the README, the change log, the documentation... anything that is
136
158
  affected by your contribution.
137
159
  * Use idiomatic Ruby and follow the syntax conventions below.
138
160
 
data/Gemfile CHANGED
@@ -14,10 +14,10 @@ rails_version = case rails
14
14
  rails
15
15
  end
16
16
 
17
- gem 'faker', '~> 2.0'
18
- gem 'sqlite3', '~> 1.4.1'
19
- gem 'pg', '~> 1.0'
20
- gem 'pry', '~> 0.12.2'
17
+ gem 'faker'
18
+ gem 'sqlite3'
19
+ gem 'pg'
20
+ gem 'pry'
21
21
  gem 'byebug'
22
22
 
23
23
  case rails
@@ -28,26 +28,26 @@ when /\// # A path
28
28
  gem 'actionpack', path: "#{rails}/actionpack"
29
29
  gem 'actionview', path: "#{rails}/actionview"
30
30
  when /^v/ # A tagged version
31
- git 'https://github.com/rails/rails.git', :tag => rails do
31
+ git 'https://github.com/rails/rails.git', tag: rails do
32
32
  gem 'activesupport'
33
33
  gem 'activemodel'
34
34
  gem 'activerecord', require: false
35
35
  gem 'actionpack'
36
36
  end
37
37
  else
38
- git 'https://github.com/rails/rails.git', :branch => rails do
38
+ git 'https://github.com/rails/rails.git', branch: rails do
39
39
  gem 'activesupport'
40
40
  gem 'activemodel'
41
41
  gem 'activerecord', require: false
42
42
  gem 'actionpack'
43
43
  end
44
44
  end
45
- gem 'mysql2', '~> 0.5.2'
45
+ gem 'mysql2'
46
46
 
47
47
  group :test do
48
48
  gem 'machinist', '~> 1.0.6'
49
- gem 'rspec', '~> 3'
50
- gem 'simplecov', :require => false
49
+ gem 'rspec'
50
+ gem 'simplecov', require: false
51
51
  end
52
52
 
53
53
  gem 'rubocop', require: false
data/README.md CHANGED
@@ -5,11 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/activerecord-hackery/ransack/badges/gpa.svg)](https://codeclimate.com/github/activerecord-hackery/ransack)
6
6
  [![Backers on Open Collective](https://opencollective.com/ransack/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/ransack/sponsors/badge.svg)](#sponsors)
7
7
 
8
- # SPECIAL ANNOUNCEMENT
9
-
10
- Please see the [Ransack Blog](https://activerecord-hackery.github.io/ransack/blog) for a special announcement from the Ransack maintainers and Ernie Miller, the original author of Ransack.
11
-
12
-
13
8
  # Introduction
14
9
 
15
10
  Ransack will help you easily add **searching to your Rails application**, without any additional dependencies.
@@ -18,7 +13,7 @@ There are advanced searching solutions around, like ElasticSearch or Algolia. **
18
13
 
19
14
  Ready to move beyond the basics? Use **advanced features** like i18n and extensive configuration options.
20
15
 
21
- Ransack is supported for Rails 7.0, 6.x on Ruby 2.6.6 and later.
16
+ Ransack is supported for Rails 7.0, 6.1 on Ruby 2.7 and later.
22
17
 
23
18
  ## Installation
24
19
 
@@ -46,7 +41,7 @@ There is [extensive documentation on Ransack](https://activerecord-hackery.githu
46
41
  * File an issue if a bug is caused by Ransack, is new (has not already been reported), and _can be reproduced from the information you provide_.
47
42
  * Please consider adding a branch with a failing spec describing the problem.
48
43
  * Contributions are welcome. :smiley:
49
- * Please do not use the issue tracker for personal support requests. Stack Overflow is a better place for that where a wider community can help you!
44
+ * Please do not use the issue tracker for personal support requests. Stack Overflow or [GitHub Discussions](https://github.com/activerecord-hackery/ransack/discussions) is a better place for that where a wider community can help you!
50
45
 
51
46
 
52
47
  ## Contributions
@@ -59,9 +54,9 @@ broken or missing. A failing spec to demonstrate the issue is awesome. A pull
59
54
  request with passing tests is even better!
60
55
  * Before filing an issue or pull request, be sure to read and follow the
61
56
  [Contributing Guide](CONTRIBUTING.md).
62
- * Please use Stack Overflow or other sites for questions or discussion not
57
+ * Please use Stack Overflow or [GitHub Discussions](https://github.com/activerecord-hackery/ransack/discussions) for questions or discussion not
63
58
  directly related to bug reports, pull requests, or documentation improvements.
64
- * Spread the word on Twitter, Facebook, and elsewhere if Ransack's been useful
59
+ * Spread the word on social media if Ransack's been useful
65
60
  to you. The more people who are using the project, the quicker we can find and
66
61
  fix bugs!
67
62
 
@@ -56,6 +56,10 @@ class Project < ActiveRecord::Base
56
56
  ransacker :number do |parent|
57
57
  parent.table[:number]
58
58
  end
59
+
60
+ def self.ransackable_attributes(_auth_object = nil)
61
+ ["name", "number"]
62
+ end
59
63
  end
60
64
 
61
65
  class BugTest < Minitest::Test
@@ -40,7 +40,7 @@ end
40
40
  html: { method: :post } do |f| %>
41
41
  ```
42
42
 
43
- Once you've done so, you can make use of the helpers in [Ransack::Helpers::FormBuilder](https://github.com/activerecord-hackery/ransack/lib/ransack/helpers/form_builder.rb) to
43
+ Once you've done so, you can make use of the helpers in [Ransack::Helpers::FormBuilder](https://github.com/activerecord-hackery/ransack/blob/main/lib/ransack/helpers/form_builder.rb) to
44
44
  construct much more complex search forms, such as the one on the
45
45
  [demo app](http://ransack-demo.herokuapp.com/users/advanced_search)
46
46
  (source code [here](https://github.com/activerecord-hackery/ransack_demo)).
@@ -64,4 +64,4 @@ List of all possible predicates
64
64
  | `*_false` | is false | |
65
65
 
66
66
 
67
- See full list: https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/locale/en.yml#L15
67
+ See full list: https://github.com/activerecord-hackery/ransack/blob/main/lib/ransack/locale/en.yml#L16
@@ -27,6 +27,10 @@ def index
27
27
  end
28
28
  ```
29
29
 
30
+ :::caution
31
+ 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.
32
+ :::
33
+
30
34
  ### Default search options
31
35
 
32
36
  #### Search parameter
@@ -50,7 +54,7 @@ This may be disabled by setting the `strip_whitespace` option in a Ransack initi
50
54
 
51
55
  ```ruby
52
56
  Ransack.configure do |c|
53
- # Change whitespace stripping behaviour.
57
+ # Change whitespace stripping behavior.
54
58
  # Default is true
55
59
  c.strip_whitespace = false
56
60
  end
@@ -60,7 +64,7 @@ end
60
64
 
61
65
  The two primary Ransack view helpers are `search_form_for` and `sort_link`,
62
66
  which are defined in
63
- [Ransack::Helpers::FormHelper](https://github.com/activerecord-hackery/ransack/lib/ransack/helpers/form_helper.rb).
67
+ [Ransack::Helpers::FormHelper](https://github.com/activerecord-hackery/ransack/blob/main/lib/ransack/helpers/form_helper.rb).
64
68
 
65
69
  ### Form helper
66
70
 
@@ -67,24 +67,24 @@ When you're writing a `Ransack` search form, you can choose any of the following
67
67
 
68
68
  ### Option A - Match keys exactly
69
69
 
70
- Option `a` will match keys exactly. This is the solution to choose if you want to distinguish 'Home' from 'Homework': searching for 'Home' will return just the `Task` with id 1. It also allows searching for more than one tag at once (comma separated):
70
+ Option `A` will match keys exactly. This is the solution to choose if you want to distinguish 'Home' from 'Homework': searching for 'Home' will return just the `Task` with id 1. It also allows searching for more than one tag at once (comma separated):
71
71
  - `Home, Personal` will return task 1
72
72
  - `Home, Homework` will return task 1 and 2
73
73
 
74
74
  ### Option B - match key combinations
75
75
 
76
- Option `b` will match all keys exactly. This is the solution if you wanna search for specific combinations of tags:
76
+ Option `B` will match all keys exactly. This is the solution if you wanna search for specific combinations of tags:
77
77
  - `Home` will return nothing, as there is no Task with just the `Home` tag
78
78
  - `Home, Personal` will return task 1
79
79
 
80
80
  ### Option C - match substrings
81
81
 
82
- Option `c` is used to match substrings. This is useful when you don't care for the exact tag, but only for part of it:
82
+ Option `C` is used to match substrings. This is useful when you don't care for the exact tag, but only for part of it:
83
83
  - `Home` will return task 1 and 2 (`/Home/` matches both `"Home"` and `"Homework"`)
84
84
 
85
85
  ### Option D - select from a list of tags
86
86
 
87
- In Option D we allow the user to select a list of valid tags and then search againt them. We use the plural name here.
87
+ In Option `D` we allow the user to select a list of valid tags and then search against them. We use the plural name here.
88
88
 
89
89
  ```erb
90
90
  <div class='form-group'>
@@ -3,7 +3,7 @@ sidebar_position: 4
3
3
  title: Form customisation
4
4
  ---
5
5
 
6
- Predicate and attribute labels in forms may be specified with I18n in a translation file (see the locale files in [Ransack::Locale](https://github.com/activerecord-hackery/ransack/activerecord-hackery/ransack/tree/master/lib/ransack/locale) for more examples):
6
+ Predicate and attribute labels in forms may be specified with I18n in a translation file (see the locale files in [Ransack::Locale](https://github.com/activerecord-hackery/ransack/tree/main/lib/ransack/locale) for more examples):
7
7
 
8
8
  ```yml
9
9
  # locales/en.yml
@@ -6,12 +6,12 @@ title: i18n
6
6
  # i18n and Ransack
7
7
 
8
8
  Ransack translation files are available in
9
- [Ransack::Locale](https://github.com/activerecord-hackery/ransack/lib/ransack/locale). You may also be interested in one of the
9
+ [Ransack::Locale](https://github.com/activerecord-hackery/ransack/tree/main/lib/ransack/locale). You may also be interested in one of the
10
10
  many translations for Ransack available at
11
11
  http://www.localeapp.com/projects/2999.
12
12
 
13
13
  Predicate and attribute translations in forms may be specified as follows (see
14
- the translation files in [Ransack::Locale](https://github.com/activerecord-hackery/ransack/lib/ransack/locale) for more examples):
14
+ the translation files in [Ransack::Locale](https://github.com/activerecord-hackery/ransack/tree/main/lib/ransack/locale) for more examples):
15
15
 
16
16
  locales/en.yml:
17
17
  ```yml
@@ -27,7 +27,7 @@ en:
27
27
  gt: greater than
28
28
  lt: less than
29
29
  models:
30
- person: Passanger
30
+ person: Passenger
31
31
  attributes:
32
32
  person:
33
33
  name: Full Name
@@ -354,7 +354,7 @@ argument are not easily usable yet, because the array currently needs to be
354
354
  wrapped in an array to function (see
355
355
  [this issue](https://github.com/activerecord-hackery/ransack/issues/404)),
356
356
  which is not compatible with Ransack form helpers. For this use case, it may be
357
- better for now to use [ransackers](https://github.com/activerecord-hackery/ransack/wiki/Using-Ransackers) instead,
357
+ better for now to use [ransackers](https://activerecord-hackery.github.io/ransack/going-further/ransackers) instead,
358
358
  where feasible. Pull requests with solutions and tests are welcome!
359
359
 
360
360
  ### Grouping queries by OR instead of AND
@@ -72,7 +72,7 @@ class ApplicationController < ActionController::Base
72
72
  end
73
73
 
74
74
  protected
75
- # GENERATE A GENERIC SESSION KEY BASED ON TEH CONTROLLER NAME
75
+ # GENERATE A GENERIC SESSION KEY BASED ON THE CONTROLLER NAME
76
76
  def search_key
77
77
  "#{controller_name}_search".to_sym
78
78
  end
@@ -13,7 +13,7 @@ See [this issue](https://github.com/activerecord-hackery/ransack/issues/321) for
13
13
 
14
14
  ### Using a fixed key
15
15
 
16
- See here for searching on a fixed key in a JSONB column: https://github.com/activerecord-hackery/ransack/wiki/Using-Ransackers#3-search-on-a-fixed-key-in-a-jsonb--hstore-column
16
+ See here for searching on a fixed key in a JSONB column: https://activerecord-hackery.github.io/ransack/going-further/ransackers/#postgres-columns
17
17
 
18
18
  ### Using the JSONB contains operator
19
19
 
data/docs/package.json CHANGED
@@ -14,15 +14,19 @@
14
14
  "write-heading-ids": "docusaurus write-heading-ids"
15
15
  },
16
16
  "dependencies": {
17
- "@docusaurus/core": "^2.0.0-beta.20",
18
- "@docusaurus/preset-classic": "^2.0.0-beta.20",
19
- "@easyops-cn/docusaurus-search-local": "^0.25.0",
17
+ "@docusaurus/core": "^2.2.0",
18
+ "@docusaurus/preset-classic": "^2.2.0",
19
+ "@easyops-cn/docusaurus-search-local": "^0.33.5",
20
20
  "@mdx-js/react": "^1.6.22",
21
21
  "clsx": "^1.1.1",
22
22
  "prism-react-renderer": "^1.3.1",
23
23
  "react": "^17.0.2",
24
24
  "react-dom": "^17.0.2"
25
25
  },
26
+ "resolutions": {
27
+ "trim": "^0.0.3",
28
+ "got": "^11.8.5"
29
+ },
26
30
  "browserslist": {
27
31
  "production": [
28
32
  ">0.5%",