ransack 2.5.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/deploy.yml +35 -0
  3. data/.github/workflows/test-deploy.yml +29 -0
  4. data/.github/workflows/test.yml +0 -18
  5. data/.nojekyll +0 -0
  6. data/CHANGELOG.md +101 -13
  7. data/CONTRIBUTING.md +1 -3
  8. data/README.md +45 -1039
  9. data/docs/.gitignore +19 -0
  10. data/docs/.nojekyll +0 -0
  11. data/docs/babel.config.js +3 -0
  12. data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
  13. data/docs/docs/getting-started/_category_.json +4 -0
  14. data/docs/docs/getting-started/advanced-mode.md +46 -0
  15. data/docs/docs/getting-started/configuration.md +47 -0
  16. data/docs/docs/getting-started/search-matches.md +67 -0
  17. data/docs/docs/getting-started/simple-mode.md +284 -0
  18. data/docs/docs/getting-started/sorting.md +79 -0
  19. data/docs/docs/getting-started/using-predicates.md +282 -0
  20. data/docs/docs/going-further/_category_.json +4 -0
  21. data/docs/docs/going-further/associations.md +70 -0
  22. data/docs/docs/going-further/custom-predicates.md +52 -0
  23. data/docs/docs/going-further/documentation.md +43 -0
  24. data/docs/docs/going-further/exporting-to-csv.md +49 -0
  25. data/docs/docs/going-further/external-guides.md +57 -0
  26. data/docs/docs/going-further/form-customisation.md +63 -0
  27. data/docs/docs/going-further/i18n.md +53 -0
  28. data/docs/{img → docs/going-further/img}/create_release.png +0 -0
  29. data/docs/docs/going-further/merging-searches.md +41 -0
  30. data/docs/docs/going-further/other-notes.md +428 -0
  31. data/docs/docs/going-further/ransackers.md +331 -0
  32. data/docs/docs/going-further/release_process.md +36 -0
  33. data/docs/docs/going-further/saving-queries.md +82 -0
  34. data/docs/docs/going-further/searching-postgres.md +57 -0
  35. data/docs/docs/going-further/wiki-contributors.md +82 -0
  36. data/docs/docs/intro.md +99 -0
  37. data/docs/docusaurus.config.js +107 -0
  38. data/docs/package.json +37 -0
  39. data/docs/sidebars.js +31 -0
  40. data/docs/src/components/HomepageFeatures/index.js +64 -0
  41. data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  42. data/docs/src/css/custom.css +39 -0
  43. data/docs/src/pages/index.module.css +23 -0
  44. data/docs/src/pages/markdown-page.md +7 -0
  45. data/docs/static/.nojekyll +0 -0
  46. data/docs/static/img/docusaurus.png +0 -0
  47. data/docs/static/img/favicon.ico +0 -0
  48. data/docs/static/img/logo.svg +1 -0
  49. data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
  50. data/docs/static/img/tutorial/localeDropdown.png +0 -0
  51. data/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  52. data/docs/static/img/undraw_docusaurus_react.svg +170 -0
  53. data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  54. data/{logo → docs/static/logo}/ransack-h.png +0 -0
  55. data/{logo → docs/static/logo}/ransack-h.svg +0 -0
  56. data/{logo → docs/static/logo}/ransack-v.png +0 -0
  57. data/{logo → docs/static/logo}/ransack-v.svg +0 -0
  58. data/{logo → docs/static/logo}/ransack.png +0 -0
  59. data/{logo → docs/static/logo}/ransack.svg +0 -0
  60. data/docs/yarn.lock +7671 -0
  61. data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +20 -1
  62. data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +0 -1
  63. data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +11 -1
  64. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -4
  65. data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -1
  66. data/lib/ransack/adapters/active_record/base.rb +0 -2
  67. data/lib/ransack/adapters/active_record/context.rb +1 -0
  68. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +1 -1
  69. data/lib/ransack/helpers/form_helper.rb +11 -3
  70. data/lib/ransack/search.rb +2 -2
  71. data/lib/ransack/version.rb +1 -1
  72. data/ransack.gemspec +4 -4
  73. data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
  74. data/spec/polyamorous/join_association_spec.rb +0 -5
  75. data/spec/polyamorous/join_dependency_spec.rb +0 -16
  76. data/spec/ransack/adapters/active_record/base_spec.rb +10 -1
  77. data/spec/ransack/helpers/form_helper_spec.rb +45 -2
  78. data/spec/ransack/search_spec.rb +23 -0
  79. data/spec/support/schema.rb +26 -0
  80. metadata +66 -19
  81. data/docs/release_process.md +0 -17
  82. data/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +0 -24
  83. data/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +0 -79
  84. data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27d9d0b5ebf5727ab6405767c7b545ae6afc6b6dc1ff6eec441d0108cea8cb11
4
- data.tar.gz: b1cd5f875a4c29434efdcaee2a1b47c9ba7fefacba802f6cac0f6c75545cc912
3
+ metadata.gz: 2599d5bd405561f9dd3c9b1b585baef6132a23653ebaf079f65aa7a326b20998
4
+ data.tar.gz: '0899eeb3faebe29e31c6ec2ec248d1b106f6fdb5175532fdb55b82abce928d19'
5
5
  SHA512:
6
- metadata.gz: '0961ec1b9a3874dfd1242d40bae780b1f5a553e418a7bdcd1e599c5a25768831ce22b12c861a2c703beb2ad157751429aa034de1769ef3c83a8837b27356f679'
7
- data.tar.gz: 7483453ea26b635323d153bd632f8c38ef03d24ca674b5266f62a870f29d7e395b81c678ae7403dd6b54b27985203e12c80701a0e990d47dcdeacc6c8b1d5aa6
6
+ metadata.gz: 0cd85c2c70494e50e4ce67351a3abb7822424372fbe5e3062415b7c3471094883f955cf6c6c57f1f783442b68d18593c0d8a220e4f1f1e68c9e1e48d80b2d9be
7
+ data.tar.gz: 24c878aceb15a2a914f4c99743df78af82aef65fda072301678bde8307ed0dfafc5506366929babf19524a221d2a57d191d7d3e4ebb2bf73760f5b4b6928d082
@@ -0,0 +1,35 @@
1
+ name: Deploy to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy:
10
+ name: Deploy to GitHub Pages
11
+
12
+ runs-on: ubuntu-20.04
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 16
20
+ cache: yarn
21
+ cache-dependency-path: docs/yarn.lock
22
+
23
+ - name: Install dependencies
24
+ run: yarn install --frozen-lockfile
25
+ working-directory: docs
26
+
27
+ - name: Build website
28
+ run: yarn build
29
+ working-directory: docs
30
+
31
+ - name: Deploy to GitHub Pages
32
+ uses: peaceiris/actions-gh-pages@v3
33
+ with:
34
+ github_token: ${{ secrets.GITHUB_TOKEN }}
35
+ publish_dir: docs/build
@@ -0,0 +1,29 @@
1
+ name: Test deploy to GitHub Pages
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test-deploy:
10
+ name: Test deploy to GitHub Pages
11
+
12
+ runs-on: ubuntu-20.04
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 16
20
+ cache: yarn
21
+ cache-dependency-path: docs/yarn.lock
22
+
23
+ - name: Install dependencies
24
+ run: yarn install --frozen-lockfile
25
+ working-directory: docs
26
+
27
+ - name: Test build website
28
+ run: yarn build
29
+ working-directory: docs
@@ -15,8 +15,6 @@ jobs:
15
15
  - v6.1.4
16
16
  - v6.0.4
17
17
  - 6-0-stable
18
- - 5-2-stable
19
- - v5.2.4
20
18
  ruby:
21
19
  - 3.0.2
22
20
  - 2.7.4
@@ -24,10 +22,6 @@ jobs:
24
22
  exclude:
25
23
  - rails: v7.0.0
26
24
  ruby: 2.6.7
27
- - rails: v5.2.4
28
- ruby: 3.0.2
29
- - rails: 5-2-stable
30
- ruby: 3.0.2
31
25
  env:
32
26
  DB: sqlite3
33
27
  RAILS: ${{ matrix.rails }}
@@ -52,8 +46,6 @@ jobs:
52
46
  - v6.1.4
53
47
  - v6.0.4
54
48
  - 6-0-stable
55
- - 5-2-stable
56
- - v5.2.4
57
49
  ruby:
58
50
  - 3.0.2
59
51
  - 2.7.4
@@ -61,10 +53,6 @@ jobs:
61
53
  exclude:
62
54
  - rails: v7.0.0
63
55
  ruby: 2.6.7
64
- - rails: v5.2.4
65
- ruby: 3.0.2
66
- - rails: 5-2-stable
67
- ruby: 3.0.2
68
56
  env:
69
57
  DB: mysql
70
58
  RAILS: ${{ matrix.rails }}
@@ -98,8 +86,6 @@ jobs:
98
86
  - v6.1.4
99
87
  - v6.0.4
100
88
  - 6-0-stable
101
- - 5-2-stable
102
- - v5.2.4
103
89
  ruby:
104
90
  - 3.0.2
105
91
  - 2.7.4
@@ -107,10 +93,6 @@ jobs:
107
93
  exclude:
108
94
  - rails: v7.0.0
109
95
  ruby: 2.6.7
110
- - rails: v5.2.4
111
- ruby: 3.0.2
112
- - rails: 5-2-stable
113
- ruby: 3.0.2
114
96
  env:
115
97
  DB: postgres
116
98
  RAILS: ${{ matrix.rails }}
data/.nojekyll ADDED
File without changes
data/CHANGELOG.md CHANGED
@@ -2,30 +2,118 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.0.1 - 2022-04-08
6
+
7
+ * Fix `:data` option to `sort_link` being incorrectly appended to the generated
8
+ link query parameters.
9
+ PR [1301](https://github.com/activerecord-hackery/ransack/pull/1301)
10
+
11
+ * Fix "Edit this page" links in documentation site
12
+ PR [1303](https://github.com/activerecord-hackery/ransack/pull/1303)
13
+
14
+ * Auto deploy documentation site after merging PRs
15
+ PR [1302](https://github.com/activerecord-hackery/ransack/pull/1302)
16
+
17
+ * Add list of former wiki contributors to documentation site
18
+ PR [1300](https://github.com/activerecord-hackery/ransack/pull/1300)
19
+
20
+ * Reduce gem package size
21
+ PR [1297](https://github.com/activerecord-hackery/ransack/pull/1297)
22
+
23
+ ## 3.0.0 - 2022-03-30
24
+
25
+ * Move documentation into Docusaurus.
26
+ PR [1291](https://github.com/activerecord-hackery/ransack/pull/1291)
27
+
28
+ * [BREAKING CHANGE] Remove deprecated `#search` method.
29
+ PR [1147](https://github.com/activerecord-hackery/ransack/pull/1147)
30
+
31
+ * Allow scopes that define string SQL joins.
32
+ PR [1225](https://github.com/activerecord-hackery/ransack/pull/1225)
33
+
34
+ * Improve `sort_link` documentation.
35
+ PR [1290](https://github.com/activerecord-hackery/ransack/pull/1290)
36
+
37
+ * Deprecate passing two trailing hashes to `sort_link`, for example:
38
+
39
+ ```ruby
40
+ sort_link(@q, :bussiness_name, "bussines_name", {}, class: "foo")
41
+ ```
42
+
43
+ Pass a single hash with all options instead.
44
+ PR [1289](https://github.com/activerecord-hackery/ransack/pull/1289)
45
+
46
+ * Fix `:class` option to `sort_link` not being passed to the generated link
47
+ correctly when no additional options are passed. For example:
48
+
49
+ ```ruby
50
+ sort_link(@q, :bussiness_name, class: "foo")
51
+ ```
52
+
53
+ PR [1288](https://github.com/activerecord-hackery/ransack/pull/1288)
54
+
55
+ * Evaluate `ransackable_scopes` before attributes when building the query.
56
+ PR [759](https://github.com/activerecord-hackery/ransack/pull/759)
57
+
58
+ ## 2.6.0 - 2022-03-08
59
+
60
+ * Fix regression when joining a table with itself.
61
+ PR [1275](https://github.com/activerecord-hackery/ransack/pull/1276)
62
+
63
+ * Drop support for ActiveRecord older than 6.0.4.
64
+ PR [1276](https://github.com/activerecord-hackery/ransack/pull/1276)
65
+
5
66
  ## 2.5.0 - 2021-12-26
6
67
 
68
+ * Document release process by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1199, https://github.com/activerecord-hackery/ransack/pull/1200.
69
+ * Support Rails 7 by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1205, https://github.com/activerecord-hackery/ransack/pull/1209, https://github.com/activerecord-hackery/ransack/pull/1234, https://github.com/activerecord-hackery/ransack/pull/1230, https://github.com/activerecord-hackery/ransack/pull/1266
70
+ * Fix for `ActiveRecord::UnknownAttributeReference` in ransack by @TechnologyHypofriend in https://github.com/activerecord-hackery/ransack/pull/1207
71
+ * Make gem compatible with old polyamorous require by @rtweeks in https://github.com/activerecord-hackery/ransack/pull/1145
72
+ * Adding swedish translations by @johanandre in https://github.com/activerecord-hackery/ransack/pull/1208
73
+ * Document how to do case insensitive searches by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1213
74
+ * Add the ability to disable whitespace stripping for string searches by @DCrow in https://github.com/activerecord-hackery/ransack/pull/1214
75
+ * Fix `:default` option in `Translate.attribute` method by @coreyaus in https://github.com/activerecord-hackery/ransack/pull/1218
76
+ * Fix typo in README.md by @d-m-u in https://github.com/activerecord-hackery/ransack/pull/1220
77
+ * Fix another typo in README.md by @plan-do-break-fix in https://github.com/activerecord-hackery/ransack/pull/1221
78
+ * Fix several documentation typos @wonda-tea-coffee in https://github.com/activerecord-hackery/ransack/pull/1233
79
+ * Allow ransack to treat nulls as always first or last by @mollerhoj in https://github.com/activerecord-hackery/ransack/pull/1226
80
+ * Consider ransack aliases when sorting by @faragorn and @waldyr in https://github.com/activerecord-hackery/ransack/pull/1223
81
+ * Fix non-casted array predicates by @danielpclark in https://github.com/activerecord-hackery/ransack/pull/1246
82
+ * Remove Squeel references from README by @Schwad in https://github.com/activerecord-hackery/ransack/pull/1249
83
+ * Remove part of the README that might lead to incorrect results by @RadekMolenda in https://github.com/activerecord-hackery/ransack/pull/1258
7
84
  * ActiveRecord 7.0 support
8
85
 
9
- * Drop support for rubies under 2.5. PR #1189
86
+ ## 2.4.2 - 2021-01-23
10
87
 
11
- * Have casted array predicates type checked to Arel::Nodes::Casted fixing non-casted array predicates.
12
- PR [1246](https://github.com/activerecord-hackery/ransack/pull/1246)
88
+ * Enable RuboCop and configure GitHub Actions to run RuboCop by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1185
89
+ * Add Ruby 3.0.0 support by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1190
90
+ * Drop Ruby 2.5 or older versions of Ruby by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1189
91
+ * Move bug report templates into ransack repository and run templates at CI by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1191
92
+ * Allow Ransack to be tested with Rails main branch by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1192
13
93
 
14
94
  ## 2.4.1 - 2020-12-21
15
95
 
16
- * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition
17
-
18
- *Aaron Lipman*
96
+ * Links to Tidelift subscription by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1178
97
+ * Enable GitHub Actions by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1180
98
+ * Move security contact information to SECURITY.md by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1179
99
+ * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition by @alipman88 in https://github.com/activerecord-hackery/ransack/pull/1132
100
+ * Add ability to config PostgreSQL ORDER BY ... NULLS FIRST or NULLS LAST by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1184
19
101
 
20
102
  ## 2.4.0 - 2020-11-27
21
103
 
22
- * Support ActiveRecord 6.1.0.rc1.
23
- PR [1172](https://github.com/activerecord-hackery/ransack/pull/1172)
24
-
25
- * Fix for ActiveRecord 5.2.4 (note security fix in 5.2.4.2 for ActiveView's escape_javascript CVE-2020-5267 for all earlier versions)
26
-
27
- * Drop support for ActiveRecord older than 5.2.4.
28
- PR [1166](https://github.com/activerecord-hackery/ransack/pull/1166)
104
+ * Specify actual version of polyamorous, so we can release that separately by @gregmolnar in https://github.com/activerecord-hackery/ransack/pull/1101
105
+ * Only include necessary files in gem package by @tvdeyen in https://github.com/activerecord-hackery/ransack/pull/1104
106
+ * Test/Fix for subquery in Rails 5.2.4 by @stevenjonescgm in https://github.com/activerecord-hackery/ransack/pull/1112
107
+ * Polyamorous module by @varyonic in https://github.com/activerecord-hackery/ransack/pull/1113
108
+ * Remove duplicated rows by @sasharevzin in https://github.com/activerecord-hackery/ransack/pull/1116
109
+ * Fix Ruby 2.7 deprecation warnings by @terracatta in https://github.com/activerecord-hackery/ransack/pull/1121
110
+ * Fixes polymorphic joins. by @PhilCoggins in https://github.com/activerecord-hackery/ransack/pull/1122
111
+ * Drop support for activerecord older than 5.2.4 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1166
112
+ * Adapt to quoting change in Rails by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1165
113
+ * Typo in docs by @brett-anderson in https://github.com/activerecord-hackery/ransack/pull/1155
114
+ * Add Rails 6.1 support by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1172
115
+ * Strip Leading & Trailing Whitespace Before Searching by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1126
116
+ * Use unfrozen version of symbol to string by @fauno in https://github.com/activerecord-hackery/ransack/pull/1149
29
117
 
30
118
  ## 2.3.2 - 2020-01-11
31
119
 
data/CONTRIBUTING.md CHANGED
@@ -64,9 +64,7 @@ Here's a quick guide:
64
64
  2. Create a thoughtfully-named branch for your changes (`git checkout -b my-new-feature`).
65
65
 
66
66
  3. Install the development dependencies by running `bundle install`.
67
- To install rails other than latest (set in Gemfile): `RAILS='5-2-stable' bundle install`
68
-
69
- $ RAILS='5-2-stable' bundle install
67
+ To install rails other than latest (set in Gemfile): `RAILS='6-0-stable' bundle install`
70
68
 
71
69
  4. Begin by running the tests. We only take pull requests with passing tests,
72
70
  and it's great to know that you have a clean slate: