ransack 1.8.4 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/SECURITY.md +12 -0
  4. data/.github/workflows/cronjob.yml +102 -0
  5. data/.github/workflows/deploy.yml +35 -0
  6. data/.github/workflows/rubocop.yml +20 -0
  7. data/.github/workflows/test-deploy.yml +29 -0
  8. data/.github/workflows/test.yml +130 -0
  9. data/.gitignore +3 -0
  10. data/{lib/ransack/adapters/mongoid/3.2/.gitkeep → .nojekyll} +0 -0
  11. data/.rubocop.yml +44 -0
  12. data/CHANGELOG.md +352 -0
  13. data/CONTRIBUTING.md +25 -13
  14. data/Gemfile +26 -27
  15. data/README.md +65 -815
  16. data/Rakefile +1 -22
  17. data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +78 -0
  18. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +71 -0
  19. data/docs/.gitignore +19 -0
  20. data/docs/.nojekyll +0 -0
  21. data/docs/babel.config.js +3 -0
  22. data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
  23. data/docs/docs/getting-started/_category_.json +4 -0
  24. data/docs/docs/getting-started/advanced-mode.md +46 -0
  25. data/docs/docs/getting-started/configuration.md +47 -0
  26. data/docs/docs/getting-started/search-matches.md +67 -0
  27. data/docs/docs/getting-started/simple-mode.md +284 -0
  28. data/docs/docs/getting-started/sorting.md +79 -0
  29. data/docs/docs/getting-started/using-predicates.md +282 -0
  30. data/docs/docs/going-further/_category_.json +4 -0
  31. data/docs/docs/going-further/acts-as-taggable-on.md +114 -0
  32. data/docs/docs/going-further/associations.md +70 -0
  33. data/docs/docs/going-further/custom-predicates.md +52 -0
  34. data/docs/docs/going-further/documentation.md +43 -0
  35. data/docs/docs/going-further/exporting-to-csv.md +49 -0
  36. data/docs/docs/going-further/external-guides.md +57 -0
  37. data/docs/docs/going-further/form-customisation.md +63 -0
  38. data/docs/docs/going-further/i18n.md +53 -0
  39. data/docs/docs/going-further/img/create_release.png +0 -0
  40. data/docs/docs/going-further/merging-searches.md +41 -0
  41. data/docs/docs/going-further/other-notes.md +428 -0
  42. data/docs/docs/going-further/polymorphic-search.md +40 -0
  43. data/docs/docs/going-further/ransackers.md +331 -0
  44. data/docs/docs/going-further/release_process.md +36 -0
  45. data/docs/docs/going-further/saving-queries.md +82 -0
  46. data/docs/docs/going-further/searching-postgres.md +57 -0
  47. data/docs/docs/going-further/wiki-contributors.md +82 -0
  48. data/docs/docs/intro.md +99 -0
  49. data/docs/docusaurus.config.js +120 -0
  50. data/docs/package.json +38 -0
  51. data/docs/sidebars.js +31 -0
  52. data/docs/src/components/HomepageFeatures/index.js +64 -0
  53. data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  54. data/docs/src/css/custom.css +39 -0
  55. data/docs/src/pages/index.module.css +23 -0
  56. data/docs/src/pages/markdown-page.md +7 -0
  57. data/docs/static/.nojekyll +0 -0
  58. data/docs/static/img/docusaurus.png +0 -0
  59. data/docs/static/img/favicon.ico +0 -0
  60. data/docs/static/img/logo.svg +1 -0
  61. data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
  62. data/docs/static/img/tutorial/localeDropdown.png +0 -0
  63. data/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  64. data/docs/static/img/undraw_docusaurus_react.svg +170 -0
  65. data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  66. data/docs/static/logo/ransack-h.png +0 -0
  67. data/docs/static/logo/ransack-h.svg +34 -0
  68. data/docs/static/logo/ransack-v.png +0 -0
  69. data/docs/static/logo/ransack-v.svg +34 -0
  70. data/docs/static/logo/ransack.png +0 -0
  71. data/docs/static/logo/ransack.svg +21 -0
  72. data/docs/yarn.lock +8436 -0
  73. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +70 -0
  74. data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +92 -0
  75. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +11 -0
  76. data/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb +1 -0
  77. data/lib/polyamorous/activerecord_7.0_ruby_2/join_dependency.rb +1 -0
  78. data/lib/polyamorous/activerecord_7.0_ruby_2/reflection.rb +1 -0
  79. data/lib/polyamorous/activerecord_7.1_ruby_2/join_association.rb +1 -0
  80. data/lib/polyamorous/activerecord_7.1_ruby_2/join_dependency.rb +1 -0
  81. data/lib/polyamorous/activerecord_7.1_ruby_2/reflection.rb +1 -0
  82. data/lib/polyamorous/join.rb +70 -0
  83. data/lib/polyamorous/polyamorous.rb +24 -0
  84. data/lib/polyamorous/swapping_reflection_class.rb +11 -0
  85. data/lib/polyamorous/tree_node.rb +7 -0
  86. data/lib/polyamorous.rb +1 -0
  87. data/lib/ransack/adapters/active_record/base.rb +14 -3
  88. data/lib/ransack/adapters/active_record/context.rb +140 -196
  89. data/lib/ransack/adapters/active_record/ransack/constants.rb +19 -4
  90. data/lib/ransack/adapters/active_record/ransack/context.rb +9 -19
  91. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +7 -7
  92. data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -5
  93. data/lib/ransack/adapters/active_record/ransack/visitor.rb +23 -0
  94. data/lib/ransack/adapters/active_record.rb +0 -9
  95. data/lib/ransack/adapters.rb +2 -0
  96. data/lib/ransack/configuration.rb +52 -2
  97. data/lib/ransack/constants.rb +1 -5
  98. data/lib/ransack/context.rb +29 -24
  99. data/lib/ransack/helpers/form_builder.rb +12 -6
  100. data/lib/ransack/helpers/form_helper.rb +11 -3
  101. data/lib/ransack/helpers.rb +1 -1
  102. data/lib/ransack/locale/ar.yml +70 -0
  103. data/lib/ransack/locale/az.yml +70 -0
  104. data/lib/ransack/locale/bg.yml +70 -0
  105. data/lib/ransack/locale/ca.yml +70 -0
  106. data/lib/ransack/locale/el.yml +70 -0
  107. data/lib/ransack/locale/es.yml +22 -22
  108. data/lib/ransack/locale/fa.yml +70 -0
  109. data/lib/ransack/locale/fi.yml +71 -0
  110. data/lib/ransack/locale/nl.yml +4 -4
  111. data/lib/ransack/locale/ru.yml +70 -0
  112. data/lib/ransack/locale/sk.yml +70 -0
  113. data/lib/ransack/locale/sv.yml +70 -0
  114. data/lib/ransack/locale/tr.yml +70 -0
  115. data/lib/ransack/locale/zh-CN.yml +12 -12
  116. data/lib/ransack/nodes/attribute.rb +2 -2
  117. data/lib/ransack/nodes/condition.rb +7 -1
  118. data/lib/ransack/nodes/grouping.rb +3 -8
  119. data/lib/ransack/nodes/sort.rb +3 -3
  120. data/lib/ransack/nodes/value.rb +3 -3
  121. data/lib/ransack/predicate.rb +13 -20
  122. data/lib/ransack/search.rb +7 -4
  123. data/lib/ransack/translate.rb +115 -115
  124. data/lib/ransack/version.rb +1 -1
  125. data/lib/ransack/visitor.rb +1 -12
  126. data/lib/ransack.rb +7 -5
  127. data/ransack.gemspec +9 -25
  128. data/spec/blueprints/articles.rb +1 -1
  129. data/spec/blueprints/comments.rb +1 -1
  130. data/spec/blueprints/notes.rb +1 -1
  131. data/spec/blueprints/tags.rb +1 -1
  132. data/spec/console.rb +5 -5
  133. data/spec/helpers/polyamorous_helper.rb +13 -0
  134. data/spec/helpers/ransack_helper.rb +1 -1
  135. data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
  136. data/spec/polyamorous/join_association_spec.rb +30 -0
  137. data/spec/polyamorous/join_dependency_spec.rb +81 -0
  138. data/spec/polyamorous/join_spec.rb +19 -0
  139. data/spec/ransack/adapters/active_record/base_spec.rb +105 -11
  140. data/spec/ransack/adapters/active_record/context_spec.rb +63 -24
  141. data/spec/ransack/configuration_spec.rb +24 -0
  142. data/spec/ransack/helpers/form_builder_spec.rb +3 -15
  143. data/spec/ransack/helpers/form_helper_spec.rb +135 -168
  144. data/spec/ransack/nodes/condition_spec.rb +13 -0
  145. data/spec/ransack/nodes/grouping_spec.rb +2 -2
  146. data/spec/ransack/nodes/value_spec.rb +115 -0
  147. data/spec/ransack/predicate_spec.rb +54 -2
  148. data/spec/ransack/search_spec.rb +266 -36
  149. data/spec/spec_helper.rb +14 -5
  150. data/spec/support/schema.rb +99 -21
  151. metadata +117 -187
  152. data/.travis.yml +0 -86
  153. data/lib/ransack/adapters/active_record/3.0/compat.rb +0 -179
  154. data/lib/ransack/adapters/active_record/3.0/context.rb +0 -203
  155. data/lib/ransack/adapters/active_record/3.1/context.rb +0 -212
  156. data/lib/ransack/adapters/active_record/3.2/context.rb +0 -44
  157. data/lib/ransack/adapters/active_record/compat.rb +0 -14
  158. data/lib/ransack/adapters/mongoid/attributes/attribute.rb +0 -37
  159. data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +0 -17
  160. data/lib/ransack/adapters/mongoid/attributes/predications.rb +0 -141
  161. data/lib/ransack/adapters/mongoid/base.rb +0 -134
  162. data/lib/ransack/adapters/mongoid/context.rb +0 -212
  163. data/lib/ransack/adapters/mongoid/inquiry_hash.rb +0 -23
  164. data/lib/ransack/adapters/mongoid/ransack/constants.rb +0 -88
  165. data/lib/ransack/adapters/mongoid/ransack/context.rb +0 -60
  166. data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +0 -27
  167. data/lib/ransack/adapters/mongoid/ransack/translate.rb +0 -13
  168. data/lib/ransack/adapters/mongoid/ransack/visitor.rb +0 -24
  169. data/lib/ransack/adapters/mongoid/table.rb +0 -35
  170. data/lib/ransack/adapters/mongoid.rb +0 -15
  171. data/spec/mongoid/adapters/mongoid/base_spec.rb +0 -314
  172. data/spec/mongoid/adapters/mongoid/context_spec.rb +0 -56
  173. data/spec/mongoid/configuration_spec.rb +0 -162
  174. data/spec/mongoid/dependencies_spec.rb +0 -8
  175. data/spec/mongoid/helpers/ransack_helper.rb +0 -11
  176. data/spec/mongoid/nodes/condition_spec.rb +0 -49
  177. data/spec/mongoid/nodes/grouping_spec.rb +0 -13
  178. data/spec/mongoid/predicate_spec.rb +0 -155
  179. data/spec/mongoid/search_spec.rb +0 -445
  180. data/spec/mongoid/support/mongoid.yml +0 -11
  181. data/spec/mongoid/support/schema.rb +0 -135
  182. data/spec/mongoid/translate_spec.rb +0 -14
  183. data/spec/mongoid_spec_helper.rb +0 -63
  184. data/spec/ransack/dependencies_spec.rb +0 -12
data/CHANGELOG.md CHANGED
@@ -1,5 +1,357 @@
1
1
  # Change Log
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 3.2.1 - 2022-05-24
6
+
7
+ * Add search functionality to documentation site.
8
+ PR [1329](https://github.com/activerecord-hackery/ransack/pull/1329)
9
+
10
+ * Fix contributing URLs and syntax highlight in `README.md`.
11
+ PR [1326](https://github.com/activerecord-hackery/ransack/pull/1326)
12
+
13
+ * Cast PostgreSQL's `timestamptz` columns to time.
14
+ PR [1325](https://github.com/activerecord-hackery/ransack/pull/1325)
15
+
16
+ * Add Ruby and ERB syntax highlighting support to documentation site.
17
+ PR [1324](https://github.com/activerecord-hackery/ransack/pull/1324)
18
+
19
+ * Fix a wrong link in `CHANGELOG.md`.
20
+ PR [1323](https://github.com/activerecord-hackery/ransack/pull/1323)
21
+
22
+ * Fix links to bug report templates in `CONTRIBUTING.md`.
23
+ PR [1321](https://github.com/activerecord-hackery/ransack/pull/1321)
24
+
25
+ ## 3.2.0 - 2022-05-08
26
+
27
+ * Drop Rails 6.0 support.
28
+ PR [1318](https://github.com/activerecord-hackery/ransack/pull/1318)
29
+
30
+ * Exclude "host" from params sent to url generator.
31
+ PR [1317](https://github.com/activerecord-hackery/ransack/pull/1317)
32
+
33
+ ## 3.1.0 - 2022-04-21
34
+
35
+ * Fix predicate name in "Using Predicates" documentation page.
36
+ PR [1313](https://github.com/activerecord-hackery/ransack/pull/1313)
37
+
38
+ * Drop Ruby 2.6 support.
39
+ PR [1311](https://github.com/activerecord-hackery/ransack/pull/1311)
40
+
41
+ * Allow Ransack to be used with Rails 7.1.0.alpha.
42
+ PR [1309](https://github.com/activerecord-hackery/ransack/pull/1309)
43
+
44
+ * Put contributor list last in documentation site.
45
+ PR [1308](https://github.com/activerecord-hackery/ransack/pull/1308)
46
+
47
+ * Add `acts-as-taggable-on` and polymorphic searches to documentation.
48
+ PR [1306](https://github.com/activerecord-hackery/ransack/pull/1306)
49
+ PR [1312](https://github.com/activerecord-hackery/ransack/pull/1312)
50
+
51
+ * Add full link to issue about merging searches to documentation.
52
+ PR [1305](https://github.com/activerecord-hackery/ransack/pull/1305)
53
+
54
+ ## 3.0.1 - 2022-04-08
55
+
56
+ * Fix `:data` option to `sort_link` being incorrectly appended to the generated
57
+ link query parameters.
58
+ PR [1301](https://github.com/activerecord-hackery/ransack/pull/1301)
59
+
60
+ * Fix "Edit this page" links in documentation site
61
+ PR [1303](https://github.com/activerecord-hackery/ransack/pull/1303)
62
+
63
+ * Auto deploy documentation site after merging PRs
64
+ PR [1302](https://github.com/activerecord-hackery/ransack/pull/1302)
65
+
66
+ * Add list of former wiki contributors to documentation site
67
+ PR [1300](https://github.com/activerecord-hackery/ransack/pull/1300)
68
+
69
+ * Reduce gem package size
70
+ PR [1297](https://github.com/activerecord-hackery/ransack/pull/1297)
71
+
72
+ ## 3.0.0 - 2022-03-30
73
+
74
+ * Move documentation into Docusaurus.
75
+ PR [1291](https://github.com/activerecord-hackery/ransack/pull/1291)
76
+
77
+ * [BREAKING CHANGE] Remove deprecated `#search` method.
78
+ PR [1147](https://github.com/activerecord-hackery/ransack/pull/1147)
79
+
80
+ * Allow scopes that define string SQL joins.
81
+ PR [1225](https://github.com/activerecord-hackery/ransack/pull/1225)
82
+
83
+ * Improve `sort_link` documentation.
84
+ PR [1290](https://github.com/activerecord-hackery/ransack/pull/1290)
85
+
86
+ * Deprecate passing two trailing hashes to `sort_link`, for example:
87
+
88
+ ```ruby
89
+ sort_link(@q, :bussiness_name, "bussines_name", {}, class: "foo")
90
+ ```
91
+
92
+ Pass a single hash with all options instead.
93
+ PR [1289](https://github.com/activerecord-hackery/ransack/pull/1289)
94
+
95
+ * Fix `:class` option to `sort_link` not being passed to the generated link
96
+ correctly when no additional options are passed. For example:
97
+
98
+ ```ruby
99
+ sort_link(@q, :bussiness_name, class: "foo")
100
+ ```
101
+
102
+ PR [1288](https://github.com/activerecord-hackery/ransack/pull/1288)
103
+
104
+ * Evaluate `ransackable_scopes` before attributes when building the query.
105
+ PR [759](https://github.com/activerecord-hackery/ransack/pull/759)
106
+
107
+ ## 2.6.0 - 2022-03-08
108
+
109
+ * Fix regression when joining a table with itself.
110
+ PR [1275](https://github.com/activerecord-hackery/ransack/pull/1276)
111
+
112
+ * Drop support for ActiveRecord older than 6.0.4.
113
+ PR [1276](https://github.com/activerecord-hackery/ransack/pull/1276)
114
+
115
+ ## 2.5.0 - 2021-12-26
116
+
117
+ * Document release process by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1199, https://github.com/activerecord-hackery/ransack/pull/1200.
118
+ * 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
119
+ * Fix for `ActiveRecord::UnknownAttributeReference` in ransack by @TechnologyHypofriend in https://github.com/activerecord-hackery/ransack/pull/1207
120
+ * Make gem compatible with old polyamorous require by @rtweeks in https://github.com/activerecord-hackery/ransack/pull/1145
121
+ * Adding swedish translations by @johanandre in https://github.com/activerecord-hackery/ransack/pull/1208
122
+ * Document how to do case insensitive searches by @scarroll32 in https://github.com/activerecord-hackery/ransack/pull/1213
123
+ * Add the ability to disable whitespace stripping for string searches by @DCrow in https://github.com/activerecord-hackery/ransack/pull/1214
124
+ * Fix `:default` option in `Translate.attribute` method by @coreyaus in https://github.com/activerecord-hackery/ransack/pull/1218
125
+ * Fix typo in README.md by @d-m-u in https://github.com/activerecord-hackery/ransack/pull/1220
126
+ * Fix another typo in README.md by @plan-do-break-fix in https://github.com/activerecord-hackery/ransack/pull/1221
127
+ * Fix several documentation typos @wonda-tea-coffee in https://github.com/activerecord-hackery/ransack/pull/1233
128
+ * Allow ransack to treat nulls as always first or last by @mollerhoj in https://github.com/activerecord-hackery/ransack/pull/1226
129
+ * Consider ransack aliases when sorting by @faragorn and @waldyr in https://github.com/activerecord-hackery/ransack/pull/1223
130
+ * Fix non-casted array predicates by @danielpclark in https://github.com/activerecord-hackery/ransack/pull/1246
131
+ * Remove Squeel references from README by @Schwad in https://github.com/activerecord-hackery/ransack/pull/1249
132
+ * Remove part of the README that might lead to incorrect results by @RadekMolenda in https://github.com/activerecord-hackery/ransack/pull/1258
133
+ * ActiveRecord 7.0 support
134
+
135
+ ## 2.4.2 - 2021-01-23
136
+
137
+ * Enable RuboCop and configure GitHub Actions to run RuboCop by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1185
138
+ * Add Ruby 3.0.0 support by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1190
139
+ * Drop Ruby 2.5 or older versions of Ruby by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1189
140
+ * Move bug report templates into ransack repository and run templates at CI by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1191
141
+ * Allow Ransack to be tested with Rails main branch by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1192
142
+
143
+ ## 2.4.1 - 2020-12-21
144
+
145
+ * Links to Tidelift subscription by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1178
146
+ * Enable GitHub Actions by @yahonda in https://github.com/activerecord-hackery/ransack/pull/1180
147
+ * Move security contact information to SECURITY.md by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1179
148
+ * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition by @alipman88 in https://github.com/activerecord-hackery/ransack/pull/1132
149
+ * Add ability to config PostgreSQL ORDER BY ... NULLS FIRST or NULLS LAST by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1184
150
+
151
+ ## 2.4.0 - 2020-11-27
152
+
153
+ * Specify actual version of polyamorous, so we can release that separately by @gregmolnar in https://github.com/activerecord-hackery/ransack/pull/1101
154
+ * Only include necessary files in gem package by @tvdeyen in https://github.com/activerecord-hackery/ransack/pull/1104
155
+ * Test/Fix for subquery in Rails 5.2.4 by @stevenjonescgm in https://github.com/activerecord-hackery/ransack/pull/1112
156
+ * Polyamorous module by @varyonic in https://github.com/activerecord-hackery/ransack/pull/1113
157
+ * Remove duplicated rows by @sasharevzin in https://github.com/activerecord-hackery/ransack/pull/1116
158
+ * Fix Ruby 2.7 deprecation warnings by @terracatta in https://github.com/activerecord-hackery/ransack/pull/1121
159
+ * Fixes polymorphic joins. by @PhilCoggins in https://github.com/activerecord-hackery/ransack/pull/1122
160
+ * Drop support for activerecord older than 5.2.4 by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1166
161
+ * Adapt to quoting change in Rails by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1165
162
+ * Typo in docs by @brett-anderson in https://github.com/activerecord-hackery/ransack/pull/1155
163
+ * Add Rails 6.1 support by @deivid-rodriguez in https://github.com/activerecord-hackery/ransack/pull/1172
164
+ * Strip Leading & Trailing Whitespace Before Searching by @itsalongstory in https://github.com/activerecord-hackery/ransack/pull/1126
165
+ * Use unfrozen version of symbol to string by @fauno in https://github.com/activerecord-hackery/ransack/pull/1149
166
+
167
+ ## 2.3.2 - 2020-01-11
168
+
169
+ * Breakfix to bump Polyamorous
170
+
171
+ ## 2.3.1 - 2020-01-11
172
+
173
+ * Drop support for Active Record 5.0, 5.1, and 5.2.0.
174
+ PR [#1073](https://github.com/activerecord-hackery/ransack/pull/1073)
175
+
176
+ * Drop support for rubies under 2.3.
177
+ PR [#1070](https://github.com/activerecord-hackery/ransack/pull/1070)
178
+
179
+ ... and others
180
+
181
+ ## 2.3.0 - 2019-08-18
182
+
183
+ * Arabic translations PR [979](https://github.com/activerecord-hackery/ransack/pull/979)
184
+
185
+ * Rails 6 PR [1027](https://github.com/activerecord-hackery/ransack/pull/1027)
186
+ *vrodokanakis*
187
+
188
+ * Make polyamorous a separate gem PR [1002](https://github.com/activerecord-hackery/ransack/pull/1002)
189
+
190
+ * Catalan translations PR[1007](https://github.com/activerecord-hackery/ransack/pull/1007)
191
+ *roslavych*
192
+
193
+ * Don't escape period characters with wildcard searches in mysql2 PR [1013](https://github.com/activerecord-hackery/ransack/pull/1013)
194
+ *daflip*
195
+
196
+ * Farsi translations PR [1030](https://github.com/activerecord-hackery/ransack/pull/1030)
197
+
198
+ * Finnish translations PR [1049](https://github.com/activerecord-hackery/ransack/pull/1049)
199
+
200
+ * Fix wrong table alias when using nested join. for ActiveRecord >= 5.2
201
+ PR [374](https://github.com/activerecord-hackery/ransack/pull/374)
202
+
203
+ *hiichan*
204
+
205
+ ## Version 2.1.1 - 2018-12-05
206
+
207
+ * Add `arabic` translation
208
+ https://github.com/activerecord-hackery/ransack/pull/979
209
+
210
+ * Deprecate #search
211
+ PR [975](https://github.com/activerecord-hackery/ransack/pull/975)
212
+
213
+ ## Version 2.1.0 - 2018-10-26
214
+
215
+ * Add support for sorting by scopes
216
+ PR [973](https://github.com/activerecord-hackery/ransack/pull/973)
217
+
218
+ *Diego Borges*
219
+
220
+ * Added a new logo for Ransack
221
+ PR [972](https://github.com/activerecord-hackery/ransack/pull/972)
222
+
223
+ *Anıl Kılıç*, *Greg Molnar*
224
+
225
+ * Greek translations
226
+ PR [971](https://github.com/activerecord-hackery/ransack/pull/971)
227
+ PR [960](https://github.com/activerecord-hackery/ransack/pull/960)
228
+
229
+ *Sean Carroll*, *Greg Molnar*
230
+
231
+ * README improvements
232
+ PR [963](https://github.com/activerecord-hackery/ransack/pull/963)
233
+
234
+ *tommaso1*
235
+
236
+ * Bulgarian translations
237
+ PR [961](https://github.com/activerecord-hackery/ransack/pull/961)
238
+
239
+ *Sean Carroll*
240
+
241
+ * README improvements
242
+ PR [956](https://github.com/activerecord-hackery/ransack/pull/956)
243
+
244
+ *Alex Konoval*
245
+
246
+ * Remove lib/ransack/adapters/active_record/compat.rb
247
+ PR [954](https://github.com/activerecord-hackery/ransack/pull/954)
248
+
249
+ *Ryuta Kamizono*
250
+
251
+ * Remove unused aliases
252
+ PR [953](https://github.com/activerecord-hackery/ransack/pull/953)
253
+
254
+ *Ryuta Kamizono*
255
+
256
+ ## Version 2.0.1 - 2018-08-18
257
+
258
+ * Don't return association if table is nil
259
+ PR [952](https://github.com/activerecord-hackery/ransack/pull/952)
260
+
261
+ *Christian Gregg*
262
+
263
+ ## Version 2.0.0 - 2018-08-09
264
+
265
+ * Add support for Active Record 5.2.1
266
+ PR [#938](https://github.com/activerecord-hackery/ransack/pull/938)
267
+
268
+ * Fix sort with joins on existing association
269
+ PR [#937](https://github.com/activerecord-hackery/ransack/pull/937)
270
+
271
+ * Add the ability to skip arg sanitization on a per scope basis. Using
272
+ `ransackable_scopes_skip_sanitize_args`, users can define a list of
273
+ scopes which will bypass parameter sanitization. This allows passing 0,
274
+ 1, t, f, etc. to a scope as an actual parameter.
275
+ PR [#933](https://github.com/activerecord-hackery/ransack/pull/933)
276
+
277
+ * Drop support for Active Record < 5.0.
278
+ PR [#929](https://github.com/activerecord-hackery/ransack/pull/929)
279
+
280
+ * Extract mongoid support to a separate gem.
281
+ PR [#928](https://github.com/activerecord-hackery/ransack/pull/928)
282
+
283
+ * Absorb polyamorous
284
+ PR [#927](https://github.com/activerecord-hackery/ransack/pull/927)
285
+
286
+ * Fix broken monkey patch of #form_with
287
+ PR [#922](https://github.com/activerecord-hackery/ransack/pull/922)
288
+
289
+ ## Version 1.8.8 - 2018-03-16
290
+ * Fix multiple database support
291
+ PR [#893](https://github.com/activerecord-hackery/ransack/pull/893)
292
+
293
+ * Updated Dutch translations
294
+ PR [#887](https://github.com/activerecord-hackery/ransack/pull/887)
295
+
296
+ * Fixed no method error 'asc' for Rails 4.2
297
+ PR [#885](https://github.com/activerecord-hackery/ransack/pull/885)
298
+
299
+
300
+ ## Version 1.8.7 - 2018-02-05
301
+
302
+ * Rails 5.2 support
303
+ PR [#868](https://github.com/activerecord-hackery/ransack/pull/868)
304
+
305
+ * Lock pg gem to 0.21 to support older releases
306
+
307
+ * Warnings cleanup
308
+ PR [#867](https://github.com/activerecord-hackery/ransack/pull/867)
309
+
310
+ * Wildcard escaping
311
+ PR [#866]
312
+
313
+ ## Version 1.8.6 - 2018-01-23
314
+
315
+ ### Added
316
+
317
+ * Improve memory usage
318
+ PR [#820](https://github.com/activerecord-hackery/ransack/pull/820)
319
+
320
+ * Bump Polyamorous version to 1.3.2
321
+ PR [#858](https://github.com/activerecord-hackery/ransack/pull/858)
322
+
323
+ ## Version 1.8.5
324
+
325
+ ### Added
326
+
327
+ * Added Turkish Translations
328
+ PR [#835](https://github.com/activerecord-hackery/ransack/issues/835).
329
+
330
+ ## Version 1.8.4 - 2017-10-09
331
+
332
+ ### Added
333
+
334
+ * Added italian translations.
335
+ PR [#833](https://github.com/activerecord-hackery/ransack/pull/833).
336
+
337
+ * Add an optional default arrow for unsorted fields.
338
+ PR [#816](https://github.com/activerecord-hackery/ransack/pull/816/files).
339
+
340
+ ### Fixed
341
+
342
+ * Cast Postgres money type to float.
343
+ PR [#823](https://github.com/activerecord-hackery/ransack/pull/823).
344
+
345
+ * Fix the bug in sort_link, which causes the multiple fields option to be
346
+ ignored when block parameter is specified.
347
+ PR [#818](https://github.com/activerecord-hackery/ransack/pull/818).
348
+
349
+ * No need pass some arguments to JoinAssociation#join_constraints in Rails 5.1.
350
+ PR [#814](https://github.com/activerecord-hackery/ransack/pull/814).
351
+ Fixes [#807](https://github.com/activerecord-hackery/ransack/issues/807).
352
+ Reference [rails/rails#28267](https://github.com/rails/rails/pull/28267)
353
+ and [rails/rails#27851](https://github.com/rails/rails/pull/27851).
354
+
3
355
  ## Version 1.8.3 - 2017-06-15
4
356
 
5
357
  ### Added
data/CONTRIBUTING.md CHANGED
@@ -20,14 +20,14 @@ Steps:
20
20
  reported.
21
21
 
22
22
  2. **Check if the issue has been fixed** &mdash; 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** &mdash; 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,6 +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='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:
@@ -75,16 +76,27 @@ Here's a quick guide:
75
76
  $ DB=pg bundle exec rake spec (`DB=postgres` & `DB=postgresql` work too)
76
77
  $ DB=mysql bundle exec rake spec
77
78
 
78
- To run only the tests in a particular file: `rspec <path/to/filename>`
79
+ For Postgres and MySQL, databases are expected to exist, called 'ransack'. To create use these commands (assuming OS X and Homebrew):
79
80
 
80
- $ rspec spec/ransack/search_spec.rb
81
+ ### Postgres
82
+ $ createdb ransack
81
83
 
82
- To run a single test in that file: `rspec <path/to/filename> -e "test name"`
84
+ ### MySQL
85
+ $ mysql -u root
86
+ mysql> create database ransack;
83
87
 
84
- $ rspec spec/ransack/search_spec.rb -e "accepts a context option"
88
+ The test suite runs by default
85
89
 
86
- 5. Hack away! Please use Ruby features that are compatible down to Ruby 1.9.
87
- Since version 1.5, Ransack no longer maintains Ruby 1.8 compatibility.
90
+ To run only the tests in a particular file: `bundle exec rspec <path/to/filename>`
91
+
92
+ $ bundle exec rspec spec/ransack/search_spec.rb
93
+
94
+ To run a single test in that file: `bundle exec rspec <path/to/filename> -e "test name"`
95
+
96
+ $ bundle exec rspec spec/ransack/search_spec.rb -e "accepts a context option"
97
+
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.
88
100
 
89
101
  6. Add tests for your changes. Only refactoring and documentation changes
90
102
  require no new tests. If you are adding functionality or fixing a bug, we
@@ -101,9 +113,9 @@ Here's a quick guide:
101
113
  $ git config --global user.email "contributor@example.com"
102
114
 
103
115
  10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
104
- If your pull request only contains documentation changes, please remember
105
- to add `[skip ci]` to the beginning of your commit message so the Travis
106
- test suite doesn't :runner: needlessly.
116
+ If your pull request only contains documentation changes, please remember
117
+ to add `[skip ci]` to the beginning of your commit message so the CI
118
+ test suite doesn't :runner: needlessly.
107
119
 
108
120
  11. If necessary, rebase your commits into logical chunks, without errors. To
109
121
  interactively rebase and cherry-pick from, say, the last 10 commits:
@@ -111,7 +123,7 @@ Here's a quick guide:
111
123
 
112
124
  12. Push the branch up to your fork on GitHub
113
125
  (`git push origin my-new-feature`) and from GitHub submit a pull request to
114
- Ransack's `master` branch.
126
+ Ransack's `main` branch.
115
127
 
116
128
  At this point you're waiting on us. We like to at least comment on, if not
117
129
  accept, pull requests within three business days (and, typically, one business
data/Gemfile CHANGED
@@ -3,52 +3,51 @@ gemspec
3
3
 
4
4
  gem 'rake'
5
5
 
6
- rails = ENV['RAILS'] || '5-0-stable'
7
-
8
- if rails == 'master'
9
- gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
10
- else
11
- gem 'polyamorous', '~> 1.3'
12
- end
13
-
14
- gem 'pry'
15
-
16
- # Provide timezone information on Windows
17
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
6
+ rails = ENV['RAILS'] || '6-1-stable'
7
+
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
16
+
17
+ gem 'faker', '~> 2.0'
18
+ gem 'sqlite3', '~> 1.4.1'
19
+ gem 'pg', '~> 1.0'
20
+ gem 'pry', '~> 0.12.2'
21
+ gem 'byebug'
18
22
 
19
23
  case rails
20
24
  when /\// # A path
21
25
  gem 'activesupport', path: "#{rails}/activesupport"
26
+ gem 'activemodel', path: "#{rails}/activemodel"
22
27
  gem 'activerecord', path: "#{rails}/activerecord", require: false
23
28
  gem 'actionpack', path: "#{rails}/actionpack"
29
+ gem 'actionview', path: "#{rails}/actionview"
24
30
  when /^v/ # A tagged version
25
- git 'git://github.com/rails/rails.git', :tag => rails do
31
+ git 'https://github.com/rails/rails.git', :tag => rails do
26
32
  gem 'activesupport'
27
33
  gem 'activemodel'
28
34
  gem 'activerecord', require: false
29
35
  gem 'actionpack'
30
36
  end
31
37
  else
32
- git 'git://github.com/rails/rails.git', :branch => rails do
38
+ git 'https://github.com/rails/rails.git', :branch => rails do
33
39
  gem 'activesupport'
34
40
  gem 'activemodel'
35
41
  gem 'activerecord', require: false
36
42
  gem 'actionpack'
37
43
  end
38
- if rails == '3-0-stable'
39
- gem 'mysql2', '< 0.3'
40
- end
41
- end
42
-
43
- if ENV['DB'] =~ /mongoid4/
44
- gem 'mongoid', '~> 4.0.0', require: false
45
- end
46
-
47
- if ENV['DB'] =~ /mongoid5/
48
- gem 'mongoid', '~> 5.0.0', require: false
49
44
  end
45
+ gem 'mysql2', '~> 0.5.2'
50
46
 
51
47
  group :test do
52
- # TestUnit was removed from Ruby 2.2 but still needed for testing Rails 3.x.
53
- gem 'test-unit', '~> 3.0' if RUBY_VERSION >= '2.2'
48
+ gem 'machinist', '~> 1.0.6'
49
+ gem 'rspec', '~> 3'
50
+ gem 'simplecov', :require => false
54
51
  end
52
+
53
+ gem 'rubocop', require: false