ransack 2.3.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/SECURITY.md +12 -0
  4. data/.github/workflows/codeql.yml +72 -0
  5. data/.github/workflows/cronjob.yml +99 -0
  6. data/.github/workflows/deploy.yml +35 -0
  7. data/.github/workflows/rubocop.yml +20 -0
  8. data/.github/workflows/test-deploy.yml +29 -0
  9. data/.github/workflows/test.yml +131 -0
  10. data/.nojekyll +0 -0
  11. data/.rubocop.yml +50 -0
  12. data/CHANGELOG.md +263 -1
  13. data/CONTRIBUTING.md +51 -29
  14. data/Gemfile +24 -10
  15. data/README.md +49 -917
  16. data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +78 -0
  17. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +75 -0
  18. data/docs/.gitignore +19 -0
  19. data/docs/.nojekyll +0 -0
  20. data/docs/babel.config.js +3 -0
  21. data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
  22. data/docs/docs/getting-started/_category_.json +4 -0
  23. data/docs/docs/getting-started/advanced-mode.md +46 -0
  24. data/docs/docs/getting-started/configuration.md +47 -0
  25. data/docs/docs/getting-started/search-matches.md +67 -0
  26. data/docs/docs/getting-started/simple-mode.md +288 -0
  27. data/docs/docs/getting-started/sorting.md +71 -0
  28. data/docs/docs/getting-started/using-predicates.md +282 -0
  29. data/docs/docs/going-further/_category_.json +4 -0
  30. data/docs/docs/going-further/acts-as-taggable-on.md +114 -0
  31. data/docs/docs/going-further/associations.md +70 -0
  32. data/docs/docs/going-further/custom-predicates.md +52 -0
  33. data/docs/docs/going-further/documentation.md +43 -0
  34. data/docs/docs/going-further/exporting-to-csv.md +49 -0
  35. data/docs/docs/going-further/external-guides.md +57 -0
  36. data/docs/docs/going-further/form-customisation.md +63 -0
  37. data/docs/docs/going-further/i18n.md +53 -0
  38. data/docs/docs/going-further/img/create_release.png +0 -0
  39. data/docs/docs/going-further/merging-searches.md +41 -0
  40. data/docs/docs/going-further/other-notes.md +428 -0
  41. data/docs/docs/going-further/polymorphic-search.md +46 -0
  42. data/docs/docs/going-further/ransackers.md +331 -0
  43. data/docs/docs/going-further/release_process.md +36 -0
  44. data/docs/docs/going-further/saving-queries.md +82 -0
  45. data/docs/docs/going-further/searching-postgres.md +57 -0
  46. data/docs/docs/going-further/wiki-contributors.md +82 -0
  47. data/docs/docs/intro.md +99 -0
  48. data/docs/docusaurus.config.js +120 -0
  49. data/docs/package.json +42 -0
  50. data/docs/sidebars.js +31 -0
  51. data/docs/src/components/HomepageFeatures/index.js +64 -0
  52. data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  53. data/docs/src/css/custom.css +39 -0
  54. data/docs/src/pages/index.module.css +23 -0
  55. data/docs/src/pages/markdown-page.md +7 -0
  56. data/docs/static/.nojekyll +0 -0
  57. data/docs/static/img/docusaurus.png +0 -0
  58. data/docs/static/img/favicon.ico +0 -0
  59. data/docs/static/img/logo.svg +1 -0
  60. data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
  61. data/docs/static/img/tutorial/localeDropdown.png +0 -0
  62. data/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  63. data/docs/static/img/undraw_docusaurus_react.svg +170 -0
  64. data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  65. data/docs/yarn.lock +8879 -0
  66. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +70 -0
  67. data/{polyamorous/lib/polyamorous/activerecord_6.0_ruby_2 → lib/polyamorous/activerecord_6.1_ruby_2}/join_dependency.rb +33 -12
  68. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +11 -0
  69. data/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb +1 -0
  70. data/lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb +1 -0
  71. data/lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb +1 -0
  72. data/lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb +1 -0
  73. data/lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb +1 -0
  74. data/lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb +1 -0
  75. data/{polyamorous/lib → lib/polyamorous}/polyamorous.rb +3 -8
  76. data/lib/ransack/adapters/active_record/base.rb +83 -10
  77. data/lib/ransack/adapters/active_record/context.rb +61 -116
  78. data/lib/ransack/configuration.rb +53 -10
  79. data/lib/ransack/constants.rb +126 -7
  80. data/lib/ransack/context.rb +34 -5
  81. data/lib/ransack/helpers/form_builder.rb +11 -17
  82. data/lib/ransack/helpers/form_helper.rb +14 -5
  83. data/lib/ransack/helpers.rb +1 -1
  84. data/lib/ransack/locale/sk.yml +70 -0
  85. data/lib/ransack/locale/sv.yml +70 -0
  86. data/lib/ransack/nodes/attribute.rb +3 -3
  87. data/lib/ransack/nodes/condition.rb +87 -8
  88. data/lib/ransack/nodes/grouping.rb +4 -4
  89. data/lib/ransack/nodes/node.rb +1 -1
  90. data/lib/ransack/nodes/sort.rb +3 -3
  91. data/lib/ransack/nodes/value.rb +3 -3
  92. data/lib/ransack/predicate.rb +3 -2
  93. data/lib/ransack/ransacker.rb +1 -1
  94. data/lib/ransack/search.rb +15 -7
  95. data/lib/ransack/translate.rb +6 -6
  96. data/lib/ransack/version.rb +1 -1
  97. data/lib/ransack/visitor.rb +38 -2
  98. data/lib/ransack.rb +6 -10
  99. data/ransack.gemspec +9 -24
  100. data/spec/blueprints/articles.rb +1 -1
  101. data/spec/blueprints/comments.rb +1 -1
  102. data/spec/blueprints/notes.rb +1 -1
  103. data/spec/blueprints/tags.rb +1 -1
  104. data/spec/console.rb +5 -5
  105. data/spec/helpers/polyamorous_helper.rb +2 -17
  106. data/spec/helpers/ransack_helper.rb +1 -1
  107. data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
  108. data/spec/{ransack → polyamorous}/join_association_spec.rb +3 -1
  109. data/spec/{ransack → polyamorous}/join_dependency_spec.rb +0 -16
  110. data/spec/ransack/adapters/active_record/base_spec.rb +125 -16
  111. data/spec/ransack/adapters/active_record/context_spec.rb +19 -18
  112. data/spec/ransack/configuration_spec.rb +33 -9
  113. data/spec/ransack/helpers/form_builder_spec.rb +8 -8
  114. data/spec/ransack/helpers/form_helper_spec.rb +109 -20
  115. data/spec/ransack/nodes/condition_spec.rb +37 -0
  116. data/spec/ransack/nodes/grouping_spec.rb +2 -2
  117. data/spec/ransack/nodes/value_spec.rb +115 -0
  118. data/spec/ransack/predicate_spec.rb +75 -2
  119. data/spec/ransack/search_spec.rb +239 -38
  120. data/spec/ransack/translate_spec.rb +1 -1
  121. data/spec/spec_helper.rb +9 -5
  122. data/spec/support/schema.rb +111 -12
  123. metadata +105 -195
  124. data/.travis.yml +0 -49
  125. data/lib/ransack/adapters/active_record/ransack/constants.rb +0 -116
  126. data/lib/ransack/adapters/active_record/ransack/context.rb +0 -60
  127. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +0 -61
  128. data/lib/ransack/adapters/active_record/ransack/translate.rb +0 -8
  129. data/lib/ransack/adapters/active_record/ransack/visitor.rb +0 -47
  130. data/lib/ransack/adapters.rb +0 -64
  131. data/lib/ransack/nodes.rb +0 -8
  132. data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -2
  133. data/polyamorous/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -2
  134. data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb +0 -31
  135. data/polyamorous/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -112
  136. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +0 -31
  137. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +0 -112
  138. data/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb +0 -12
  139. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb +0 -22
  140. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_dependency.rb +0 -81
  141. data/polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb +0 -2
  142. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +0 -2
  143. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +0 -2
  144. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -2
  145. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -2
  146. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +0 -2
  147. data/polyamorous/lib/polyamorous/version.rb +0 -3
  148. data/polyamorous/polyamorous.gemspec +0 -35
  149. /data/{logo → docs/static/logo}/ransack-h.png +0 -0
  150. /data/{logo → docs/static/logo}/ransack-h.svg +0 -0
  151. /data/{logo → docs/static/logo}/ransack-v.png +0 -0
  152. /data/{logo → docs/static/logo}/ransack-v.svg +0 -0
  153. /data/{logo → docs/static/logo}/ransack.png +0 -0
  154. /data/{logo → docs/static/logo}/ransack.svg +0 -0
  155. /data/{polyamorous/lib → lib}/polyamorous/join.rb +0 -0
  156. /data/{polyamorous/lib → lib}/polyamorous/swapping_reflection_class.rb +0 -0
  157. /data/{polyamorous/lib → lib}/polyamorous/tree_node.rb +0 -0
  158. /data/lib/ransack/{adapters/active_record.rb → active_record.rb} +0 -0
  159. /data/spec/{ransack → polyamorous}/join_spec.rb +0 -0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,268 @@
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
+
91
+ ## 3.2.1 - 2022-05-24
92
+
93
+ * Add search functionality to documentation site.
94
+ PR [1329](https://github.com/activerecord-hackery/ransack/pull/1329)
95
+
96
+ * Fix contributing URLs and syntax highlight in `README.md`.
97
+ PR [1326](https://github.com/activerecord-hackery/ransack/pull/1326)
98
+
99
+ * Cast PostgreSQL's `timestamptz` columns to time.
100
+ PR [1325](https://github.com/activerecord-hackery/ransack/pull/1325)
101
+
102
+ * Add Ruby and ERB syntax highlighting support to documentation site.
103
+ PR [1324](https://github.com/activerecord-hackery/ransack/pull/1324)
104
+
105
+ * Fix a wrong link in `CHANGELOG.md`.
106
+ PR [1323](https://github.com/activerecord-hackery/ransack/pull/1323)
107
+
108
+ * Fix links to bug report templates in `CONTRIBUTING.md`.
109
+ PR [1321](https://github.com/activerecord-hackery/ransack/pull/1321)
110
+
111
+ ## 3.2.0 - 2022-05-08
112
+
113
+ * Drop Rails 6.0 support.
114
+ PR [1318](https://github.com/activerecord-hackery/ransack/pull/1318)
115
+
116
+ * Exclude "host" from params sent to url generator.
117
+ PR [1317](https://github.com/activerecord-hackery/ransack/pull/1317)
118
+
119
+ ## 3.1.0 - 2022-04-21
120
+
121
+ * Fix predicate name in "Using Predicates" documentation page.
122
+ PR [1313](https://github.com/activerecord-hackery/ransack/pull/1313)
123
+
124
+ * Drop Ruby 2.6 support.
125
+ PR [1311](https://github.com/activerecord-hackery/ransack/pull/1311)
126
+
127
+ * Allow Ransack to be used with Rails 7.1.0.alpha.
128
+ PR [1309](https://github.com/activerecord-hackery/ransack/pull/1309)
129
+
130
+ * Put contributor list last in documentation site.
131
+ PR [1308](https://github.com/activerecord-hackery/ransack/pull/1308)
132
+
133
+ * Add `acts-as-taggable-on` and polymorphic searches to documentation.
134
+ PR [1306](https://github.com/activerecord-hackery/ransack/pull/1306)
135
+ PR [1312](https://github.com/activerecord-hackery/ransack/pull/1312)
136
+
137
+ * Add full link to issue about merging searches to documentation.
138
+ PR [1305](https://github.com/activerecord-hackery/ransack/pull/1305)
139
+
140
+ ## 3.0.1 - 2022-04-08
141
+
142
+ * Fix `:data` option to `sort_link` being incorrectly appended to the generated
143
+ link query parameters.
144
+ PR [1301](https://github.com/activerecord-hackery/ransack/pull/1301)
145
+
146
+ * Fix "Edit this page" links in documentation site
147
+ PR [1303](https://github.com/activerecord-hackery/ransack/pull/1303)
148
+
149
+ * Auto deploy documentation site after merging PRs
150
+ PR [1302](https://github.com/activerecord-hackery/ransack/pull/1302)
151
+
152
+ * Add list of former wiki contributors to documentation site
153
+ PR [1300](https://github.com/activerecord-hackery/ransack/pull/1300)
154
+
155
+ * Reduce gem package size
156
+ PR [1297](https://github.com/activerecord-hackery/ransack/pull/1297)
157
+
158
+ ## 3.0.0 - 2022-03-30
159
+
160
+ * Move documentation into Docusaurus.
161
+ PR [1291](https://github.com/activerecord-hackery/ransack/pull/1291)
162
+
163
+ * [BREAKING CHANGE] Remove deprecated `#search` method.
164
+ PR [1147](https://github.com/activerecord-hackery/ransack/pull/1147)
165
+
166
+ * Allow scopes that define string SQL joins.
167
+ PR [1225](https://github.com/activerecord-hackery/ransack/pull/1225)
168
+
169
+ * Improve `sort_link` documentation.
170
+ PR [1290](https://github.com/activerecord-hackery/ransack/pull/1290)
171
+
172
+ * Deprecate passing two trailing hashes to `sort_link`, for example:
173
+
174
+ ```ruby
175
+ sort_link(@q, :bussiness_name, "bussines_name", {}, class: "foo")
176
+ ```
177
+
178
+ Pass a single hash with all options instead.
179
+ PR [1289](https://github.com/activerecord-hackery/ransack/pull/1289)
180
+
181
+ * Fix `:class` option to `sort_link` not being passed to the generated link
182
+ correctly when no additional options are passed. For example:
183
+
184
+ ```ruby
185
+ sort_link(@q, :bussiness_name, class: "foo")
186
+ ```
187
+
188
+ PR [1288](https://github.com/activerecord-hackery/ransack/pull/1288)
189
+
190
+ * Evaluate `ransackable_scopes` before attributes when building the query.
191
+ PR [759](https://github.com/activerecord-hackery/ransack/pull/759)
192
+
193
+ ## 2.6.0 - 2022-03-08
194
+
195
+ * Fix regression when joining a table with itself.
196
+ PR [1275](https://github.com/activerecord-hackery/ransack/pull/1276)
197
+
198
+ * Drop support for ActiveRecord older than 6.0.4.
199
+ PR [1276](https://github.com/activerecord-hackery/ransack/pull/1276)
200
+
201
+ ## 2.5.0 - 2021-12-26
202
+
203
+ * Document release process by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1199, https://github.com/activerecord-hackery/ransack/pull/1200.
204
+ * 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
205
+ * Fix for `ActiveRecord::UnknownAttributeReference` in ransack by @TechnologyHypofriend in https://github.com/activerecord-hackery/ransack/pull/1207
206
+ * Make gem compatible with old polyamorous require by @rtweeks in https://github.com/activerecord-hackery/ransack/pull/1145
207
+ * Adding swedish translations by @johanandre in https://github.com/activerecord-hackery/ransack/pull/1208
208
+ * Document how to do case insensitive searches by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1213
209
+ * Add the ability to disable whitespace stripping for string searches by @DCrow in https://github.com/activerecord-hackery/ransack/pull/1214
210
+ * Fix `:default` option in `Translate.attribute` method by @coreyaus in https://github.com/activerecord-hackery/ransack/pull/1218
211
+ * Fix typo in README.md by @d-m-u in https://github.com/activerecord-hackery/ransack/pull/1220
212
+ * Fix another typo in README.md by @plan-do-break-fix in https://github.com/activerecord-hackery/ransack/pull/1221
213
+ * Fix several documentation typos @wonda-tea-coffee in https://github.com/activerecord-hackery/ransack/pull/1233
214
+ * Allow ransack to treat nulls as always first or last by @mollerhoj in https://github.com/activerecord-hackery/ransack/pull/1226
215
+ * Consider ransack aliases when sorting by @faragorn and @waldyr in https://github.com/activerecord-hackery/ransack/pull/1223
216
+ * Fix non-casted array predicates by @danielpclark in https://github.com/activerecord-hackery/ransack/pull/1246
217
+ * Remove Squeel references from README by @Schwad in https://github.com/activerecord-hackery/ransack/pull/1249
218
+ * Remove part of the README that might lead to incorrect results by @RadekMolenda in https://github.com/activerecord-hackery/ransack/pull/1258
219
+ * ActiveRecord 7.0 support
220
+
221
+ ## 2.4.2 - 2021-01-23
222
+
223
+ * Enable RuboCop and configure GitHub Actions to run RuboCop by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1185
224
+ * Add Ruby 3.0.0 support by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1190
225
+ * Drop Ruby 2.5 or older versions of Ruby by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1189
226
+ * Move bug report templates into ransack repository and run templates at CI by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1191
227
+ * Allow Ransack to be tested with Rails main branch by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1192
228
+
229
+ ## 2.4.1 - 2020-12-21
230
+
231
+ * Links to Tidelift subscription by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1178
232
+ * Enable GitHub Actions by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1180
233
+ * Move security contact information to SECURITY.md by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1179
234
+ * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition by @alipman88 in https://github.com/activerecord-hackery/ransack/pull/1132
235
+ * Add ability to config PostgreSQL ORDER BY ... NULLS FIRST or NULLS LAST by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1184
236
+
237
+ ## 2.4.0 - 2020-11-27
238
+
239
+ * Specify actual version of polyamorous, so we can release that separately by @gregmolnar in https://github.com/activerecord-hackery/ransack/pull/1101
240
+ * Only include necessary files in gem package by @tvdeyen in https://github.com/activerecord-hackery/ransack/pull/1104
241
+ * Test/Fix for subquery in Rails 5.2.4 by @stevenjonescgm in https://github.com/activerecord-hackery/ransack/pull/1112
242
+ * Polyamorous module by @varyonic in https://github.com/activerecord-hackery/ransack/pull/1113
243
+ * Remove duplicated rows by @sasharevzin in https://github.com/activerecord-hackery/ransack/pull/1116
244
+ * Fix Ruby 2.7 deprecation warnings by @terracatta in https://github.com/activerecord-hackery/ransack/pull/1121
245
+ * Fixes polymorphic joins. by @PhilCoggins in https://github.com/activerecord-hackery/ransack/pull/1122
246
+ * Drop support for activerecord older than 5.2.4 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1166
247
+ * Adapt to quoting change in Rails by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1165
248
+ * Typo in docs by @brett-anderson in https://github.com/activerecord-hackery/ransack/pull/1155
249
+ * Add Rails 6.1 support by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1172
250
+ * Strip Leading & Trailing Whitespace Before Searching by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1126
251
+ * Use unfrozen version of symbol to string by @fauno in https://github.com/activerecord-hackery/ransack/pull/1149
252
+
253
+ ## 2.3.2 - 2020-01-11
254
+
255
+ * Breakfix to bump Polyamorous
256
+
257
+ ## 2.3.1 - 2020-01-11
258
+
259
+ * Drop support for Active Record 5.0, 5.1, and 5.2.0.
260
+ PR [#1073](https://github.com/activerecord-hackery/ransack/pull/1073)
261
+
262
+ * Drop support for rubies under 2.3.
263
+ PR [#1070](https://github.com/activerecord-hackery/ransack/pull/1070)
264
+
265
+ ... and others
266
+
5
267
  ## 2.3.0 - 2019-08-18
6
268
 
7
269
  * Arabic translations PR [979](https://github.com/activerecord-hackery/ransack/pull/979)
@@ -170,7 +432,7 @@
170
432
  ignored when block parameter is specified.
171
433
  PR [#818](https://github.com/activerecord-hackery/ransack/pull/818).
172
434
 
173
- * No need pass some arugments to JoinAssociation#join_constraints in Rails 5.1.
435
+ * No need pass some arguments to JoinAssociation#join_constraints in Rails 5.1.
174
436
  PR [#814](https://github.com/activerecord-hackery/ransack/pull/814).
175
437
  Fixes [#807](https://github.com/activerecord-hackery/ransack/issues/807).
176
438
  Reference [rails/rails#28267](https://github.com/rails/rails/pull/28267)
data/CONTRIBUTING.md CHANGED
@@ -20,14 +20,14 @@ Steps:
20
20
  reported.
21
21
 
22
22
  2. **Check if the issue has been fixed** — try to reproduce it using the
23
- `master` branch in the repository.
23
+ `main` branch in the repository.
24
24
 
25
25
  3. **Isolate the real problem** — make sure the issue is really a bug in
26
26
  Ransack and not in your code or another gem.
27
27
 
28
28
  4. **Report the issue** by providing the link to a self-contained
29
- gist like [this](https://gist.github.com/jonatack/63048bc5062a84ba9e09) or
30
- [this](https://gist.github.com/jonatack/5df41a0edb53b7bad989). Please use
29
+ gist like [this](https://github.com/activerecord-hackery/ransack/blob/main/bug_report_templates/test-ransack-scope-and-column-same-name.rb) or
30
+ [this](https://github.com/activerecord-hackery/ransack/blob/main/bug_report_templates/test-ransacker-arel-present-predicate.rb). Please use
31
31
  these code examples as a bug-report template for your Ransack issue!
32
32
 
33
33
  If you do not provide a self-contained gist and would like your issue to be reviewed, do provide at a minimum:
@@ -64,63 +64,85 @@ 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='6-1-stable' bundle install`
67
68
 
68
69
  4. Begin by running the tests. We only take pull requests with passing tests,
69
70
  and it's great to know that you have a clean slate:
70
71
 
71
- $ bundle exec rake spec
72
+ ```sh
73
+ bundle exec rake spec
74
+ ```
72
75
 
73
76
  The test suite runs by default with SQLite3. To run the test suite with PostgreSQL or MySQL, use:
74
77
 
75
- $ DB=pg bundle exec rake spec (`DB=postgres` & `DB=postgresql` work too)
76
- $ 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
+ ```
77
88
 
78
89
  For Postgres and MySQL, databases are expected to exist, called 'ransack'. To create use these commands (assuming OS X and Homebrew):
79
90
 
80
91
  ### Postgres
81
- $ createdb ransack
92
+
93
+ ```sh
94
+ createdb ransack
95
+ ```
82
96
 
83
97
  ### MySQL
84
- $ mysql -u root
85
- mysql> create database ransack;
98
+
99
+ ```sh
100
+ mysql -u root
101
+ mysql> create database ransack;
102
+ ```
86
103
 
87
- To run only the tests in a particular file: `rspec <path/to/filename>`
104
+ The test suite runs by default
88
105
 
89
- $ rspec spec/ransack/search_spec.rb
106
+ To run only the tests in a particular file: `bundle exec rspec <path/to/filename>`
90
107
 
91
- To run a single test in that file: `rspec <path/to/filename> -e "test name"`
108
+ ```sh
109
+ bundle exec rspec spec/ransack/search_spec.rb
110
+ ```
92
111
 
93
- $ rspec spec/ransack/search_spec.rb -e "accepts a context option"
112
+ To run a single test in that file: `bundle exec rspec <path/to/filename> -e "test name"`
94
113
 
95
- 5. Hack away! Please use Ruby features that are compatible down to Ruby 1.9.
96
- Since version 1.5, Ransack no longer maintains Ruby 1.8 compatibility.
114
+ ```sh
115
+ bundle exec rspec spec/ransack/search_spec.rb -e "accepts a context option"
116
+ ```
97
117
 
98
- 6. Add tests for your changes. Only refactoring and documentation changes
118
+ 5. Add tests for your changes. Only refactoring and documentation changes
99
119
  require no new tests. If you are adding functionality or fixing a bug, we
100
120
  need a test!
101
121
 
102
- 7. Make the tests pass.
122
+ 6. Make the tests pass.
103
123
 
104
- 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
105
125
  the README.
106
126
 
107
- 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:
108
128
 
109
- $ git config --global user.name "Your Name"
110
- $ 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
+ ```
111
133
 
112
- 10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
113
- If your pull request only contains documentation changes, please remember
114
- to add `[skip ci]` to the beginning of your commit message so the Travis
115
- test suite doesn't :runner: needlessly.
134
+ 9. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
135
+ If your pull request only contains documentation changes, please remember
136
+ to add `[skip ci]` to the beginning of your commit message so the CI
137
+ test suite doesn't :runner: needlessly.
116
138
 
117
- 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
118
140
  interactively rebase and cherry-pick from, say, the last 10 commits:
119
141
  `git rebase -i HEAD~10`, then `git push -f`.
120
142
 
121
- 12. Push the branch up to your fork on GitHub
143
+ 11. Push the branch up to your fork on GitHub
122
144
  (`git push origin my-new-feature`) and from GitHub submit a pull request to
123
- Ransack's `master` branch.
145
+ Ransack's `main` branch.
124
146
 
125
147
  At this point you're waiting on us. We like to at least comment on, if not
126
148
  accept, pull requests within three business days (and, typically, one business
@@ -129,7 +151,7 @@ day). We may suggest some changes or improvements or alternatives.
129
151
  Some things that will increase the chance that your pull request is accepted:
130
152
 
131
153
  * Include tests that fail without your code, and pass with it.
132
- * Update the README, the change log, the wiki documentation... anything that is
154
+ * Update the README, the change log, the documentation... anything that is
133
155
  affected by your contribution.
134
156
  * Use idiomatic Ruby and follow the syntax conventions below.
135
157
 
data/Gemfile CHANGED
@@ -3,37 +3,51 @@ gemspec
3
3
 
4
4
  gem 'rake'
5
5
 
6
- rails = ENV['RAILS'] || '6-0-stable'
6
+ rails = ENV['RAILS'] || '7-1-stable'
7
7
 
8
- gem 'pry'
8
+ rails_version = case rails
9
+ when /\// # A path
10
+ File.read(File.join(rails, "RAILS_VERSION"))
11
+ when /^v/ # A tagged version
12
+ rails.gsub(/^v/, '')
13
+ else
14
+ rails
15
+ end
9
16
 
10
- # Provide timezone information on Windows
11
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
17
+ gem 'faker'
18
+ gem 'sqlite3'
19
+ gem 'pg'
20
+ gem 'pry'
21
+ gem 'byebug'
12
22
 
13
23
  case rails
14
24
  when /\// # A path
15
25
  gem 'activesupport', path: "#{rails}/activesupport"
26
+ gem 'activemodel', path: "#{rails}/activemodel"
16
27
  gem 'activerecord', path: "#{rails}/activerecord", require: false
17
28
  gem 'actionpack', path: "#{rails}/actionpack"
29
+ gem 'actionview', path: "#{rails}/actionview"
18
30
  when /^v/ # A tagged version
19
- git 'https://github.com/rails/rails.git', :tag => rails do
31
+ git 'https://github.com/rails/rails.git', tag: rails do
20
32
  gem 'activesupport'
21
33
  gem 'activemodel'
22
34
  gem 'activerecord', require: false
23
35
  gem 'actionpack'
24
36
  end
25
37
  else
26
- git 'https://github.com/rails/rails.git', :branch => rails do
38
+ git 'https://github.com/rails/rails.git', branch: rails do
27
39
  gem 'activesupport'
28
40
  gem 'activemodel'
29
41
  gem 'activerecord', require: false
30
42
  gem 'actionpack'
31
43
  end
32
44
  end
33
- gem 'mysql2', '~> 0.5.2'
45
+ gem 'mysql2'
34
46
 
35
47
  group :test do
36
- # TestUnit was removed from Ruby 2.2 but still needed for testing Rails 3.x.
37
- gem 'test-unit', '~> 3.0' if RUBY_VERSION >= '2.2'
38
- gem 'simplecov', :require => false
48
+ gem 'machinist', '~> 1.0.6'
49
+ gem 'rspec'
50
+ gem 'simplecov', require: false
39
51
  end
52
+
53
+ gem 'rubocop', require: false