ransack 3.2.1 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql.yml +72 -0
  3. data/.github/workflows/cronjob.yml +6 -9
  4. data/.github/workflows/deploy.yml +1 -1
  5. data/.github/workflows/rubocop.yml +2 -2
  6. data/.github/workflows/test-deploy.yml +1 -1
  7. data/.github/workflows/test.yml +23 -22
  8. data/.rubocop.yml +7 -1
  9. data/CHANGELOG.md +86 -0
  10. data/CONTRIBUTING.md +40 -21
  11. data/Gemfile +10 -10
  12. data/README.md +4 -9
  13. data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +1 -1
  14. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +5 -1
  15. data/docs/docs/getting-started/advanced-mode.md +1 -1
  16. data/docs/docs/getting-started/search-matches.md +1 -1
  17. data/docs/docs/getting-started/simple-mode.md +6 -2
  18. data/docs/docs/getting-started/sorting.md +45 -53
  19. data/docs/docs/going-further/acts-as-taggable-on.md +4 -4
  20. data/docs/docs/going-further/form-customisation.md +1 -1
  21. data/docs/docs/going-further/i18n.md +3 -3
  22. data/docs/docs/going-further/other-notes.md +2 -2
  23. data/docs/docs/going-further/polymorphic-search.md +6 -0
  24. data/docs/docs/going-further/saving-queries.md +1 -1
  25. data/docs/docs/going-further/searching-postgres.md +1 -1
  26. data/docs/package.json +7 -3
  27. data/docs/yarn.lock +2371 -1928
  28. data/lib/polyamorous/{activerecord_6.1_ruby_2 → activerecord}/join_dependency.rb +14 -4
  29. data/lib/polyamorous/polyamorous.rb +3 -4
  30. data/lib/ransack/adapters/active_record/base.rb +78 -7
  31. data/lib/ransack/adapters/active_record/context.rb +2 -1
  32. data/lib/ransack/configuration.rb +25 -12
  33. data/lib/ransack/constants.rb +125 -0
  34. data/lib/ransack/context.rb +34 -5
  35. data/lib/ransack/helpers/form_builder.rb +3 -3
  36. data/lib/ransack/helpers/form_helper.rb +3 -2
  37. data/lib/ransack/nodes/attribute.rb +2 -2
  38. data/lib/ransack/nodes/condition.rb +80 -7
  39. data/lib/ransack/nodes/grouping.rb +3 -3
  40. data/lib/ransack/nodes/node.rb +1 -1
  41. data/lib/ransack/nodes/value.rb +1 -1
  42. data/lib/ransack/predicate.rb +1 -1
  43. data/lib/ransack/ransacker.rb +1 -1
  44. data/lib/ransack/search.rb +9 -4
  45. data/lib/ransack/translate.rb +2 -2
  46. data/lib/ransack/version.rb +1 -1
  47. data/lib/ransack/visitor.rb +38 -2
  48. data/lib/ransack.rb +3 -6
  49. data/ransack.gemspec +1 -1
  50. data/spec/ransack/adapters/active_record/base_spec.rb +89 -0
  51. data/spec/ransack/configuration_spec.rb +9 -9
  52. data/spec/ransack/helpers/form_builder_spec.rb +8 -8
  53. data/spec/ransack/helpers/form_helper_spec.rb +36 -2
  54. data/spec/ransack/nodes/condition_spec.rb +24 -0
  55. data/spec/ransack/predicate_spec.rb +36 -1
  56. data/spec/ransack/translate_spec.rb +1 -1
  57. data/spec/support/schema.rb +55 -10
  58. metadata +9 -22
  59. data/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb +0 -1
  60. data/lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb +0 -1
  61. data/lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb +0 -1
  62. data/lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb +0 -1
  63. data/lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb +0 -1
  64. data/lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb +0 -1
  65. data/lib/polyamorous.rb +0 -1
  66. data/lib/ransack/adapters/active_record/ransack/constants.rb +0 -128
  67. data/lib/ransack/adapters/active_record/ransack/context.rb +0 -56
  68. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +0 -61
  69. data/lib/ransack/adapters/active_record/ransack/translate.rb +0 -8
  70. data/lib/ransack/adapters/active_record/ransack/visitor.rb +0 -47
  71. data/lib/ransack/adapters.rb +0 -64
  72. data/lib/ransack/nodes.rb +0 -8
  73. /data/lib/polyamorous/{activerecord_6.1_ruby_2 → activerecord}/join_association.rb +0 -0
  74. /data/lib/polyamorous/{activerecord_6.1_ruby_2 → activerecord}/reflection.rb +0 -0
  75. /data/lib/ransack/{adapters/active_record.rb → active_record.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ce966153aee54a3e24eb4ec775569926813ed7273839e5d042dbbc6b3addf8
4
- data.tar.gz: 4d96b0ecae077f0096494a99f90e8cfb3555140fe194c79ed691b2760319e51c
3
+ metadata.gz: dbeb7a329e22aabf90d2336f563ebfa162e0fa4a085fa5271896ed106d2d6612
4
+ data.tar.gz: e65a2f50206b930faaf7d5fd554830c553fc0050777f98f493de8e99940e3c78
5
5
  SHA512:
6
- metadata.gz: 5d23fb2ddc8ef40489c40e02202b3d051305252c21b5f6c2823478442ce326990b22a26ee46861212b690ada0632328ce6c5065cba238bd185eecc46fd5555c5
7
- data.tar.gz: 5dffd2910eefdfe2633d13a4b7d36838340f45fb484f025fed264e5df5b69c730df16257f11e7425a0852f99255b1f22e970c6407a9f5f4c59c2ca027f6e8804
6
+ metadata.gz: 1c0ece8ec2de53c780769d572369442c93b0c4769fe8394baa32ad87d4ae2b7a2fdc66b2f1227499b7a07df80f24d3cf0671a72a33c988fe43c926e37a42dbe1
7
+ data.tar.gz: fa6ba91dab6d66369595b8ddee0e46c80b5f1103ca179f67c0be75f78109555a15f784448441fb04c9d8f3afba92c04e56962d77eb4cc4870cff0ecc61f49a1e
@@ -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
@@ -6,13 +6,12 @@ on:
6
6
 
7
7
  jobs:
8
8
  sqlite3:
9
- runs-on: ubuntu-20.04
9
+ runs-on: ubuntu-22.04
10
10
  strategy:
11
11
  fail-fast: false
12
12
  matrix:
13
13
  ruby:
14
- - 3.0.2
15
- - 2.7.4
14
+ - 3.2.2
16
15
  env:
17
16
  DB: sqlite3
18
17
  RAILS: main
@@ -28,13 +27,12 @@ jobs:
28
27
  run: bundle exec rspec
29
28
 
30
29
  mysql:
31
- runs-on: ubuntu-20.04
30
+ runs-on: ubuntu-22.04
32
31
  strategy:
33
32
  fail-fast: false
34
33
  matrix:
35
34
  ruby:
36
- - 3.0.2
37
- - 2.7.4
35
+ - 3.2.2
38
36
  env:
39
37
  DB: mysql
40
38
  RAILS: main
@@ -59,13 +57,12 @@ jobs:
59
57
  run: bundle exec rspec
60
58
 
61
59
  postgres:
62
- runs-on: ubuntu-20.04
60
+ runs-on: ubuntu-22.04
63
61
  strategy:
64
62
  fail-fast: false
65
63
  matrix:
66
64
  ruby:
67
- - 3.0.2
68
- - 2.7.4
65
+ - 3.2.2
69
66
  env:
70
67
  DB: postgres
71
68
  RAILS: main
@@ -9,7 +9,7 @@ jobs:
9
9
  deploy:
10
10
  name: Deploy to GitHub Pages
11
11
 
12
- runs-on: ubuntu-20.04
12
+ runs-on: ubuntu-22.04
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v3
@@ -6,14 +6,14 @@ on:
6
6
 
7
7
  jobs:
8
8
  build:
9
- runs-on: ubuntu-20.04
9
+ runs-on: ubuntu-22.04
10
10
 
11
11
  steps:
12
12
  - uses: actions/checkout@v2
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
15
  with:
16
- ruby-version: 3.0.1
16
+ ruby-version: 3.2.2
17
17
  - name: Install gems
18
18
  run: bundle install --jobs 4 --retry 3
19
19
  - name: Run RuboCop
@@ -9,7 +9,7 @@ jobs:
9
9
  test-deploy:
10
10
  name: Test deploy to GitHub Pages
11
11
 
12
- runs-on: ubuntu-20.04
12
+ runs-on: ubuntu-22.04
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v3
@@ -2,21 +2,24 @@ name: test
2
2
 
3
3
  on:
4
4
  push:
5
+ branches:
6
+ - main
5
7
  pull_request:
6
8
 
7
9
  jobs:
8
10
  sqlite3:
9
- runs-on: ubuntu-20.04
11
+ runs-on: ubuntu-22.04
10
12
  strategy:
11
13
  fail-fast: false
12
14
  matrix:
13
15
  rails:
16
+ - v7.1.0
14
17
  - v7.0.3
15
18
  - v6.1.6
16
19
  ruby:
17
- - 3.1.2
18
- - 3.0.4
19
- - 2.7.6
20
+ - 3.2.2
21
+ - 3.1.4
22
+ - 3.0.6
20
23
  env:
21
24
  DB: sqlite3
22
25
  RAILS: ${{ matrix.rails }}
@@ -26,23 +29,23 @@ jobs:
26
29
  uses: ruby/setup-ruby@v1
27
30
  with:
28
31
  ruby-version: ${{ matrix.ruby }}
29
- - name: Install dependencies
30
- run: bundle install
32
+ bundler-cache: true
31
33
  - name: Run tests
32
34
  run: bundle exec rspec
33
35
 
34
36
  mysql:
35
- runs-on: ubuntu-20.04
37
+ runs-on: ubuntu-22.04
36
38
  strategy:
37
39
  fail-fast: false
38
40
  matrix:
39
41
  rails:
42
+ - v7.1.0
40
43
  - v7.0.3
41
44
  - v6.1.6
42
45
  ruby:
43
- - 3.1.2
44
- - 3.0.4
45
- - 2.7.6
46
+ - 3.2.2
47
+ - 3.1.4
48
+ - 3.0.6
46
49
  env:
47
50
  DB: mysql
48
51
  RAILS: ${{ matrix.rails }}
@@ -54,6 +57,7 @@ jobs:
54
57
  uses: ruby/setup-ruby@v1
55
58
  with:
56
59
  ruby-version: ${{ matrix.ruby }}
60
+ bundler-cache: true
57
61
  - name: Startup MySQL
58
62
  run: |
59
63
  sudo systemctl start mysql.service
@@ -61,23 +65,22 @@ jobs:
61
65
  run: |
62
66
  mysql --user=root --password=root --host=127.0.0.1 -e 'create database ransack collate utf8_general_ci;';
63
67
  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
68
  - name: Run tests
67
69
  run: bundle exec rspec
68
70
 
69
71
  postgres:
70
- runs-on: ubuntu-20.04
72
+ runs-on: ubuntu-22.04
71
73
  strategy:
72
74
  fail-fast: false
73
75
  matrix:
74
76
  rails:
77
+ - v7.1.0
75
78
  - v7.0.3
76
79
  - v6.1.6
77
80
  ruby:
78
- - 3.1.2
79
- - 3.0.4
80
- - 2.7.6
81
+ - 3.2.2
82
+ - 3.1.4
83
+ - 3.0.6
81
84
  env:
82
85
  DB: postgres
83
86
  RAILS: ${{ matrix.rails }}
@@ -105,24 +108,22 @@ jobs:
105
108
  uses: ruby/setup-ruby@v1
106
109
  with:
107
110
  ruby-version: ${{ matrix.ruby }}
111
+ bundler-cache: true
108
112
  - name: Setup databases
109
113
  run: |
110
114
  psql -h localhost -p 5432 -W postgres -c 'create database ransack;' -U postgres;
111
- - name: Install dependencies
112
- run: bundle install
113
115
  - name: Run tests
114
116
  run: bundle exec rspec
115
117
 
116
118
  bug-report-templates:
117
- runs-on: ubuntu-20.04
119
+ runs-on: ubuntu-22.04
118
120
  steps:
119
121
  - uses: actions/checkout@v2
120
122
  - name: Set up Ruby
121
123
  uses: ruby/setup-ruby@v1
122
124
  with:
123
- ruby-version: 3.1.2
124
- - name: Install dependencies
125
- run: bundle install
125
+ ruby-version: 3.2.2
126
+ bundler-cache: true
126
127
  - name: Run bug report templates
127
128
  run: |
128
129
  ruby bug_report_templates/test-ransacker-arel-present-predicate.rb
data/.rubocop.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 3.0
3
3
 
4
4
  DisabledByDefault: true
5
5
 
6
+ Exclude:
7
+ - "docs/**/*"
8
+
6
9
  Layout/EmptyLineAfterMagicComment:
7
10
  Enabled: true
8
11
 
@@ -30,6 +33,9 @@ Layout/SpaceInsideParens:
30
33
  Layout/TrailingEmptyLines:
31
34
  Enabled: true
32
35
 
36
+ Style/HashSyntax:
37
+ Enabled: true
38
+
33
39
  Style/RedundantFileExtensionInRequire:
34
40
  Enabled: true
35
41
 
data/CHANGELOG.md CHANGED
@@ -2,6 +2,92 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 🚀 Features
6
+
7
+ * Add Rails 7.1.0 support by @yuki24 in https://github.com/activerecord-hackery/ransack/pull/1439
8
+
9
+ ## 🐛 Bug Fixes
10
+
11
+ * Fix wrong table aliases in Rails 6.1 by @oneiros in https://github.com/activerecord-hackery/ransack/pull/1447
12
+
13
+ ## 💦 Compatibility
14
+
15
+ * Drop Ruby 2.7 support by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1449
16
+
17
+ ## 📝 Documentation
18
+
19
+ * Update blog post link by @meg-gutshall in https://github.com/activerecord-hackery/ransack/pull/1425
20
+ * Add namespaced example of Polymorphic search by @craigmcnamara in https://github.com/activerecord-hackery/ransack/pull/1422
21
+ * Update sorting example to be self-contained by @kinduff in https://github.com/activerecord-hackery/ransack/pull/1442
22
+
23
+ ## 💅 Polish
24
+
25
+ * Minor updates for Rails 7.1 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1448
26
+ * Don't mention Ruby compatibility in contribution instructions by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1452
27
+
28
+ ## 🏠 Internal
29
+
30
+ * Bump @sideway/formula from 3.0.0 to 3.0.1 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1417
31
+ * Bump webpack from 5.74.0 to 5.76.1 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1412
32
+ * Bump semver from 5.7.1 to 5.7.2 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1431
33
+ * Bump @babel/traverse from 7.18.2 to 7.23.2 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1446
34
+ * Bump postcss from 8.4.14 to 8.4.31 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1443
35
+ * Bump dns-packet from 5.3.1 to 5.6.1 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1450
36
+ * Test with Ruby 3.2 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1451
37
+ * Misc CI bumps by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1453
38
+ * RuboCop tweaks by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1454
39
+
40
+ ## 4.0.0 - 2023-02-09
41
+
42
+ ### 💥 Breaking Changes
43
+
44
+ * **[SECURITY]** Require explict allowlisting of attributes and associations by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1400
45
+ * Remove Polyamorous entrypoint by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1370
46
+ * Remove dead MongoDB code by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1345
47
+
48
+ ### 🚀 Features
49
+
50
+ * Add support for default predicates by @p8 in https://github.com/activerecord-hackery/ransack/pull/1384
51
+
52
+ ### 🐛 Bug Fixes
53
+
54
+ * Ignore `ActiveModel::RangeError` in Ransack conditions by @JunichiIto in https://github.com/activerecord-hackery/ransack/pull/1340
55
+ * Fix crash when using `q=string` as parameter by @stereobooster in https://github.com/activerecord-hackery/ransack/pull/1374
56
+ * Prevent changing host through params by @AndersGM in https://github.com/activerecord-hackery/ransack/pull/1391
57
+
58
+ ### 📝 Documentation
59
+
60
+ * Fix broken documentation link by @cpgo in https://github.com/activerecord-hackery/ransack/pull/1332
61
+ * Remove more old wiki references by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1333
62
+ * Improve some wording and correct some typos by @ydah in https://github.com/activerecord-hackery/ransack/pull/1336
63
+ * Add warning about necessary authorization by @AmShaegar13 in https://github.com/activerecord-hackery/ransack/pull/1367
64
+ * Fix required Ruby and Rails version in README by @tagliala in https://github.com/activerecord-hackery/ransack/pull/1389
65
+
66
+ ### 💅 Polish
67
+
68
+ * Implement CodeQL by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1334
69
+ * Code quality improvements by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1371
70
+ * Refactor adapters by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1348
71
+ * Fix typo: teh -> the by @jdufresne in https://github.com/activerecord-hackery/ransack/pull/1387
72
+ * Fix broken link by @maful in https://github.com/activerecord-hackery/ransack/pull/1394
73
+
74
+ ### 🏠 Internal
75
+
76
+ * Bump docusaurus by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1338
77
+ * Update dependencies by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1342
78
+ * Improve CI by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1351
79
+ * Improve CONTRIBUTING.md by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1347
80
+ * Add links to GitHub Discussions by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1353
81
+ * Bump terser from 5.14.0 to 5.14.2 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1355
82
+ * Bump loader-utils from 2.0.2 to 2.0.3 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1372
83
+ * Bump loader-utils from 2.0.3 to 2.0.4 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1378
84
+ * Upgrade some documentation dependencies by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1379
85
+ * Upgrade local search plugin too by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1380
86
+ * Bump json5 from 2.2.1 to 2.2.3 in /docs by @dependabot in https://github.com/activerecord-hackery/ransack/pull/1390
87
+ * 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
88
+ * Bump some doc deps by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1398
89
+ * 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
90
+
5
91
  ## 3.2.1 - 2022-05-24
6
92
 
7
93
  * Add search functionality to documentation site.
data/CONTRIBUTING.md CHANGED
@@ -69,59 +69,78 @@ 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
- 5. Hack away! Please use Ruby features that are compatible down to Ruby 2.3.
99
- Since version 2.3.1, Ransack no longer maintains Ruby 2.2 compatibility.
100
-
101
- 6. Add tests for your changes. Only refactoring and documentation changes
118
+ 5. Add tests for your changes. Only refactoring and documentation changes
102
119
  require no new tests. If you are adding functionality or fixing a bug, we
103
120
  need a test!
104
121
 
105
- 7. Make the tests pass.
122
+ 6. Make the tests pass.
106
123
 
107
- 8. Update the Change Log. If you are adding new functionality, document it in
124
+ 7. Update the Change Log. If you are adding new functionality, document it in
108
125
  the README.
109
126
 
110
- 9. Make sure git knows your name and email address in your `~/.gitconfig` file:
127
+ 8. Make sure git knows your name and email address in your `~/.gitconfig` file:
111
128
 
112
- $ git config --global user.name "Your Name"
113
- $ git config --global user.email "contributor@example.com"
129
+ ```sh
130
+ git config --global user.name "Your Name"
131
+ git config --global user.email "contributor@example.com"
132
+ ```
114
133
 
115
- 10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
134
+ 9. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
116
135
  If your pull request only contains documentation changes, please remember
117
136
  to add `[skip ci]` to the beginning of your commit message so the CI
118
137
  test suite doesn't :runner: needlessly.
119
138
 
120
- 11. If necessary, rebase your commits into logical chunks, without errors. To
139
+ 10. If necessary, rebase your commits into logical chunks, without errors. To
121
140
  interactively rebase and cherry-pick from, say, the last 10 commits:
122
141
  `git rebase -i HEAD~10`, then `git push -f`.
123
142
 
124
- 12. Push the branch up to your fork on GitHub
143
+ 11. Push the branch up to your fork on GitHub
125
144
  (`git push origin my-new-feature`) and from GitHub submit a pull request to
126
145
  Ransack's `main` branch.
127
146
 
@@ -132,7 +151,7 @@ day). We may suggest some changes or improvements or alternatives.
132
151
  Some things that will increase the chance that your pull request is accepted:
133
152
 
134
153
  * Include tests that fail without your code, and pass with it.
135
- * Update the README, the change log, the wiki documentation... anything that is
154
+ * Update the README, the change log, the documentation... anything that is
136
155
  affected by your contribution.
137
156
  * Use idiomatic Ruby and follow the syntax conventions below.
138
157
 
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ gemspec
3
3
 
4
4
  gem 'rake'
5
5
 
6
- rails = ENV['RAILS'] || '6-1-stable'
6
+ rails = ENV['RAILS'] || '7-1-stable'
7
7
 
8
8
  rails_version = case rails
9
9
  when /\// # A path
@@ -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 3.0 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
 
@@ -12,7 +12,7 @@ unless File.exist?('Gemfile')
12
12
  source 'https://rubygems.org'
13
13
 
14
14
  # Rails master
15
- gem 'rails', github: 'rails/rails', branch: '6-1-stable'
15
+ gem 'rails', github: 'rails/rails', branch: '7-1-stable'
16
16
 
17
17
  # Rails last release
18
18
  # gem 'rails'
@@ -10,7 +10,7 @@ unless File.exist?('Gemfile')
10
10
  source 'https://rubygems.org'
11
11
 
12
12
  # Rails master
13
- gem 'rails', github: 'rails/rails', branch: '6-1-stable'
13
+ gem 'rails', github: 'rails/rails', branch: '7-1-stable'
14
14
 
15
15
  # Rails last release
16
16
  # gem 'rails'
@@ -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