ransack 2.3.0 → 4.0.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 +102 -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 +128 -0
  10. data/.nojekyll +0 -0
  11. data/.rubocop.yml +47 -0
  12. data/CHANGELOG.md +228 -1
  13. data/CONTRIBUTING.md +47 -22
  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 +79 -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 +40 -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 +8790 -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 +23 -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 +59 -115
  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 +109 -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 +83 -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,233 @@
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
+
56
+ ## 3.2.1 - 2022-05-24
57
+
58
+ * Add search functionality to documentation site.
59
+ PR [1329](https://github.com/activerecord-hackery/ransack/pull/1329)
60
+
61
+ * Fix contributing URLs and syntax highlight in `README.md`.
62
+ PR [1326](https://github.com/activerecord-hackery/ransack/pull/1326)
63
+
64
+ * Cast PostgreSQL's `timestamptz` columns to time.
65
+ PR [1325](https://github.com/activerecord-hackery/ransack/pull/1325)
66
+
67
+ * Add Ruby and ERB syntax highlighting support to documentation site.
68
+ PR [1324](https://github.com/activerecord-hackery/ransack/pull/1324)
69
+
70
+ * Fix a wrong link in `CHANGELOG.md`.
71
+ PR [1323](https://github.com/activerecord-hackery/ransack/pull/1323)
72
+
73
+ * Fix links to bug report templates in `CONTRIBUTING.md`.
74
+ PR [1321](https://github.com/activerecord-hackery/ransack/pull/1321)
75
+
76
+ ## 3.2.0 - 2022-05-08
77
+
78
+ * Drop Rails 6.0 support.
79
+ PR [1318](https://github.com/activerecord-hackery/ransack/pull/1318)
80
+
81
+ * Exclude "host" from params sent to url generator.
82
+ PR [1317](https://github.com/activerecord-hackery/ransack/pull/1317)
83
+
84
+ ## 3.1.0 - 2022-04-21
85
+
86
+ * Fix predicate name in "Using Predicates" documentation page.
87
+ PR [1313](https://github.com/activerecord-hackery/ransack/pull/1313)
88
+
89
+ * Drop Ruby 2.6 support.
90
+ PR [1311](https://github.com/activerecord-hackery/ransack/pull/1311)
91
+
92
+ * Allow Ransack to be used with Rails 7.1.0.alpha.
93
+ PR [1309](https://github.com/activerecord-hackery/ransack/pull/1309)
94
+
95
+ * Put contributor list last in documentation site.
96
+ PR [1308](https://github.com/activerecord-hackery/ransack/pull/1308)
97
+
98
+ * Add `acts-as-taggable-on` and polymorphic searches to documentation.
99
+ PR [1306](https://github.com/activerecord-hackery/ransack/pull/1306)
100
+ PR [1312](https://github.com/activerecord-hackery/ransack/pull/1312)
101
+
102
+ * Add full link to issue about merging searches to documentation.
103
+ PR [1305](https://github.com/activerecord-hackery/ransack/pull/1305)
104
+
105
+ ## 3.0.1 - 2022-04-08
106
+
107
+ * Fix `:data` option to `sort_link` being incorrectly appended to the generated
108
+ link query parameters.
109
+ PR [1301](https://github.com/activerecord-hackery/ransack/pull/1301)
110
+
111
+ * Fix "Edit this page" links in documentation site
112
+ PR [1303](https://github.com/activerecord-hackery/ransack/pull/1303)
113
+
114
+ * Auto deploy documentation site after merging PRs
115
+ PR [1302](https://github.com/activerecord-hackery/ransack/pull/1302)
116
+
117
+ * Add list of former wiki contributors to documentation site
118
+ PR [1300](https://github.com/activerecord-hackery/ransack/pull/1300)
119
+
120
+ * Reduce gem package size
121
+ PR [1297](https://github.com/activerecord-hackery/ransack/pull/1297)
122
+
123
+ ## 3.0.0 - 2022-03-30
124
+
125
+ * Move documentation into Docusaurus.
126
+ PR [1291](https://github.com/activerecord-hackery/ransack/pull/1291)
127
+
128
+ * [BREAKING CHANGE] Remove deprecated `#search` method.
129
+ PR [1147](https://github.com/activerecord-hackery/ransack/pull/1147)
130
+
131
+ * Allow scopes that define string SQL joins.
132
+ PR [1225](https://github.com/activerecord-hackery/ransack/pull/1225)
133
+
134
+ * Improve `sort_link` documentation.
135
+ PR [1290](https://github.com/activerecord-hackery/ransack/pull/1290)
136
+
137
+ * Deprecate passing two trailing hashes to `sort_link`, for example:
138
+
139
+ ```ruby
140
+ sort_link(@q, :bussiness_name, "bussines_name", {}, class: "foo")
141
+ ```
142
+
143
+ Pass a single hash with all options instead.
144
+ PR [1289](https://github.com/activerecord-hackery/ransack/pull/1289)
145
+
146
+ * Fix `:class` option to `sort_link` not being passed to the generated link
147
+ correctly when no additional options are passed. For example:
148
+
149
+ ```ruby
150
+ sort_link(@q, :bussiness_name, class: "foo")
151
+ ```
152
+
153
+ PR [1288](https://github.com/activerecord-hackery/ransack/pull/1288)
154
+
155
+ * Evaluate `ransackable_scopes` before attributes when building the query.
156
+ PR [759](https://github.com/activerecord-hackery/ransack/pull/759)
157
+
158
+ ## 2.6.0 - 2022-03-08
159
+
160
+ * Fix regression when joining a table with itself.
161
+ PR [1275](https://github.com/activerecord-hackery/ransack/pull/1276)
162
+
163
+ * Drop support for ActiveRecord older than 6.0.4.
164
+ PR [1276](https://github.com/activerecord-hackery/ransack/pull/1276)
165
+
166
+ ## 2.5.0 - 2021-12-26
167
+
168
+ * Document release process by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1199, https://github.com/activerecord-hackery/ransack/pull/1200.
169
+ * 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
170
+ * Fix for `ActiveRecord::UnknownAttributeReference` in ransack by @TechnologyHypofriend in https://github.com/activerecord-hackery/ransack/pull/1207
171
+ * Make gem compatible with old polyamorous require by @rtweeks in https://github.com/activerecord-hackery/ransack/pull/1145
172
+ * Adding swedish translations by @johanandre in https://github.com/activerecord-hackery/ransack/pull/1208
173
+ * Document how to do case insensitive searches by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1213
174
+ * Add the ability to disable whitespace stripping for string searches by @DCrow in https://github.com/activerecord-hackery/ransack/pull/1214
175
+ * Fix `:default` option in `Translate.attribute` method by @coreyaus in https://github.com/activerecord-hackery/ransack/pull/1218
176
+ * Fix typo in README.md by @d-m-u in https://github.com/activerecord-hackery/ransack/pull/1220
177
+ * Fix another typo in README.md by @plan-do-break-fix in https://github.com/activerecord-hackery/ransack/pull/1221
178
+ * Fix several documentation typos @wonda-tea-coffee in https://github.com/activerecord-hackery/ransack/pull/1233
179
+ * Allow ransack to treat nulls as always first or last by @mollerhoj in https://github.com/activerecord-hackery/ransack/pull/1226
180
+ * Consider ransack aliases when sorting by @faragorn and @waldyr in https://github.com/activerecord-hackery/ransack/pull/1223
181
+ * Fix non-casted array predicates by @danielpclark in https://github.com/activerecord-hackery/ransack/pull/1246
182
+ * Remove Squeel references from README by @Schwad in https://github.com/activerecord-hackery/ransack/pull/1249
183
+ * Remove part of the README that might lead to incorrect results by @RadekMolenda in https://github.com/activerecord-hackery/ransack/pull/1258
184
+ * ActiveRecord 7.0 support
185
+
186
+ ## 2.4.2 - 2021-01-23
187
+
188
+ * Enable RuboCop and configure GitHub Actions to run RuboCop by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1185
189
+ * Add Ruby 3.0.0 support by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1190
190
+ * Drop Ruby 2.5 or older versions of Ruby by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1189
191
+ * Move bug report templates into ransack repository and run templates at CI by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1191
192
+ * Allow Ransack to be tested with Rails main branch by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1192
193
+
194
+ ## 2.4.1 - 2020-12-21
195
+
196
+ * Links to Tidelift subscription by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1178
197
+ * Enable GitHub Actions by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1180
198
+ * Move security contact information to SECURITY.md by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1179
199
+ * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition by @alipman88 in https://github.com/activerecord-hackery/ransack/pull/1132
200
+ * Add ability to config PostgreSQL ORDER BY ... NULLS FIRST or NULLS LAST by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1184
201
+
202
+ ## 2.4.0 - 2020-11-27
203
+
204
+ * Specify actual version of polyamorous, so we can release that separately by @gregmolnar in https://github.com/activerecord-hackery/ransack/pull/1101
205
+ * Only include necessary files in gem package by @tvdeyen in https://github.com/activerecord-hackery/ransack/pull/1104
206
+ * Test/Fix for subquery in Rails 5.2.4 by @stevenjonescgm in https://github.com/activerecord-hackery/ransack/pull/1112
207
+ * Polyamorous module by @varyonic in https://github.com/activerecord-hackery/ransack/pull/1113
208
+ * Remove duplicated rows by @sasharevzin in https://github.com/activerecord-hackery/ransack/pull/1116
209
+ * Fix Ruby 2.7 deprecation warnings by @terracatta in https://github.com/activerecord-hackery/ransack/pull/1121
210
+ * Fixes polymorphic joins. by @PhilCoggins in https://github.com/activerecord-hackery/ransack/pull/1122
211
+ * Drop support for activerecord older than 5.2.4 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1166
212
+ * Adapt to quoting change in Rails by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1165
213
+ * Typo in docs by @brett-anderson in https://github.com/activerecord-hackery/ransack/pull/1155
214
+ * Add Rails 6.1 support by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1172
215
+ * Strip Leading & Trailing Whitespace Before Searching by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1126
216
+ * Use unfrozen version of symbol to string by @fauno in https://github.com/activerecord-hackery/ransack/pull/1149
217
+
218
+ ## 2.3.2 - 2020-01-11
219
+
220
+ * Breakfix to bump Polyamorous
221
+
222
+ ## 2.3.1 - 2020-01-11
223
+
224
+ * Drop support for Active Record 5.0, 5.1, and 5.2.0.
225
+ PR [#1073](https://github.com/activerecord-hackery/ransack/pull/1073)
226
+
227
+ * Drop support for rubies under 2.3.
228
+ PR [#1070](https://github.com/activerecord-hackery/ransack/pull/1070)
229
+
230
+ ... and others
231
+
5
232
  ## 2.3.0 - 2019-08-18
6
233
 
7
234
  * Arabic translations PR [979](https://github.com/activerecord-hackery/ransack/pull/979)
@@ -170,7 +397,7 @@
170
397
  ignored when block parameter is specified.
171
398
  PR [#818](https://github.com/activerecord-hackery/ransack/pull/818).
172
399
 
173
- * No need pass some arugments to JoinAssociation#join_constraints in Rails 5.1.
400
+ * No need pass some arguments to JoinAssociation#join_constraints in Rails 5.1.
174
401
  PR [#814](https://github.com/activerecord-hackery/ransack/pull/814).
175
402
  Fixes [#807](https://github.com/activerecord-hackery/ransack/issues/807).
176
403
  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,36 +64,59 @@ 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
+ ```
117
+
118
+ 5. Hack away! Please use Ruby features that are compatible down to Ruby 2.3.
119
+ Since version 2.3.1, Ransack no longer maintains Ruby 2.2 compatibility.
97
120
 
98
121
  6. Add tests for your changes. Only refactoring and documentation changes
99
122
  require no new tests. If you are adding functionality or fixing a bug, we
@@ -106,13 +129,15 @@ Here's a quick guide:
106
129
 
107
130
  9. Make sure git knows your name and email address in your `~/.gitconfig` file:
108
131
 
109
- $ git config --global user.name "Your Name"
110
- $ 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
+ ```
111
136
 
112
137
  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.
138
+ If your pull request only contains documentation changes, please remember
139
+ to add `[skip ci]` to the beginning of your commit message so the CI
140
+ test suite doesn't :runner: needlessly.
116
141
 
117
142
  11. If necessary, rebase your commits into logical chunks, without errors. To
118
143
  interactively rebase and cherry-pick from, say, the last 10 commits:
@@ -120,7 +145,7 @@ Here's a quick guide:
120
145
 
121
146
  12. Push the branch up to your fork on GitHub
122
147
  (`git push origin my-new-feature`) and from GitHub submit a pull request to
123
- Ransack's `master` branch.
148
+ Ransack's `main` branch.
124
149
 
125
150
  At this point you're waiting on us. We like to at least comment on, if not
126
151
  accept, pull requests within three business days (and, typically, one business
@@ -129,7 +154,7 @@ day). We may suggest some changes or improvements or alternatives.
129
154
  Some things that will increase the chance that your pull request is accepted:
130
155
 
131
156
  * Include tests that fail without your code, and pass with it.
132
- * Update the README, the change log, the wiki documentation... anything that is
157
+ * Update the README, the change log, the documentation... anything that is
133
158
  affected by your contribution.
134
159
  * Use idiomatic Ruby and follow the syntax conventions below.
135
160
 
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'] || '6-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