ransack 1.7.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) 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/test.yml +120 -0
  5. data/.gitignore +3 -0
  6. data/CHANGELOG.md +463 -27
  7. data/CONTRIBUTING.md +52 -22
  8. data/Gemfile +24 -24
  9. data/README.md +453 -126
  10. data/Rakefile +6 -25
  11. data/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +24 -0
  12. data/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +79 -0
  13. data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +11 -0
  14. data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +1 -0
  15. data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +80 -0
  16. data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +1 -0
  17. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +74 -0
  18. data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +93 -0
  19. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +1 -0
  20. data/lib/polyamorous/join.rb +70 -0
  21. data/lib/polyamorous/polyamorous.rb +24 -0
  22. data/lib/polyamorous/swapping_reflection_class.rb +11 -0
  23. data/lib/polyamorous/tree_node.rb +7 -0
  24. data/lib/ransack/adapters/active_record/base.rb +27 -2
  25. data/lib/ransack/adapters/active_record/context.rb +213 -139
  26. data/lib/ransack/adapters/active_record/ransack/constants.rb +70 -55
  27. data/lib/ransack/adapters/active_record/ransack/context.rb +10 -18
  28. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +42 -32
  29. data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -5
  30. data/lib/ransack/adapters/active_record/ransack/visitor.rb +23 -0
  31. data/lib/ransack/adapters/active_record.rb +11 -10
  32. data/lib/ransack/adapters.rb +45 -23
  33. data/lib/ransack/configuration.rb +107 -4
  34. data/lib/ransack/constants.rb +13 -26
  35. data/lib/ransack/context.rb +45 -33
  36. data/lib/ransack/helpers/form_builder.rb +21 -12
  37. data/lib/ransack/helpers/form_helper.rb +75 -70
  38. data/lib/ransack/locale/ar.yml +70 -0
  39. data/lib/ransack/locale/az.yml +70 -0
  40. data/lib/ransack/locale/bg.yml +70 -0
  41. data/lib/ransack/locale/ca.yml +70 -0
  42. data/lib/ransack/locale/da.yml +70 -0
  43. data/lib/ransack/locale/el.yml +70 -0
  44. data/lib/ransack/locale/es.yml +22 -22
  45. data/lib/ransack/locale/fa.yml +70 -0
  46. data/lib/ransack/locale/fi.yml +71 -0
  47. data/lib/ransack/locale/id.yml +70 -0
  48. data/lib/ransack/locale/it.yml +70 -0
  49. data/lib/ransack/locale/ja.yml +70 -0
  50. data/lib/ransack/locale/nl.yml +4 -4
  51. data/lib/ransack/locale/pt-BR.yml +70 -0
  52. data/lib/ransack/locale/ru.yml +70 -0
  53. data/lib/ransack/locale/sk.yml +70 -0
  54. data/lib/ransack/locale/tr.yml +70 -0
  55. data/lib/ransack/locale/{zh.yml → zh-CN.yml} +13 -13
  56. data/lib/ransack/locale/zh-TW.yml +70 -0
  57. data/lib/ransack/nodes/attribute.rb +5 -2
  58. data/lib/ransack/nodes/bindable.rb +18 -6
  59. data/lib/ransack/nodes/condition.rb +85 -28
  60. data/lib/ransack/nodes/grouping.rb +17 -11
  61. data/lib/ransack/nodes/sort.rb +9 -5
  62. data/lib/ransack/nodes/value.rb +74 -68
  63. data/lib/ransack/nodes.rb +1 -1
  64. data/lib/ransack/predicate.rb +17 -20
  65. data/lib/ransack/search.rb +17 -8
  66. data/lib/ransack/translate.rb +115 -115
  67. data/lib/ransack/version.rb +1 -1
  68. data/lib/ransack/visitor.rb +1 -12
  69. data/lib/ransack.rb +9 -9
  70. data/logo/ransack-h.png +0 -0
  71. data/logo/ransack-h.svg +34 -0
  72. data/logo/ransack-v.png +0 -0
  73. data/logo/ransack-v.svg +34 -0
  74. data/logo/ransack.png +0 -0
  75. data/logo/ransack.svg +21 -0
  76. data/ransack.gemspec +7 -24
  77. data/spec/console.rb +4 -0
  78. data/spec/helpers/polyamorous_helper.rb +19 -0
  79. data/spec/polyamorous/join_association_spec.rb +35 -0
  80. data/spec/polyamorous/join_dependency_spec.rb +97 -0
  81. data/spec/polyamorous/join_spec.rb +19 -0
  82. data/spec/ransack/adapters/active_record/base_spec.rb +370 -75
  83. data/spec/ransack/adapters/active_record/context_spec.rb +72 -34
  84. data/spec/ransack/configuration_spec.rb +97 -14
  85. data/spec/ransack/helpers/form_builder_spec.rb +2 -11
  86. data/spec/ransack/helpers/form_helper_spec.rb +481 -113
  87. data/spec/ransack/nodes/condition_spec.rb +24 -0
  88. data/spec/ransack/nodes/grouping_spec.rb +56 -0
  89. data/spec/ransack/predicate_spec.rb +79 -5
  90. data/spec/ransack/search_spec.rb +207 -81
  91. data/spec/spec_helper.rb +8 -0
  92. data/spec/support/schema.rb +100 -42
  93. metadata +57 -184
  94. data/.travis.yml +0 -69
  95. data/lib/ransack/adapters/active_record/3.0/compat.rb +0 -179
  96. data/lib/ransack/adapters/active_record/3.0/context.rb +0 -201
  97. data/lib/ransack/adapters/active_record/3.1/context.rb +0 -215
  98. data/lib/ransack/adapters/active_record/3.2/context.rb +0 -44
  99. data/lib/ransack/adapters/active_record/compat.rb +0 -14
  100. data/lib/ransack/adapters/mongoid/3.2/.gitkeep +0 -0
  101. data/lib/ransack/adapters/mongoid/attributes/attribute.rb +0 -37
  102. data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +0 -17
  103. data/lib/ransack/adapters/mongoid/attributes/predications.rb +0 -141
  104. data/lib/ransack/adapters/mongoid/base.rb +0 -130
  105. data/lib/ransack/adapters/mongoid/context.rb +0 -208
  106. data/lib/ransack/adapters/mongoid/inquiry_hash.rb +0 -23
  107. data/lib/ransack/adapters/mongoid/ransack/constants.rb +0 -88
  108. data/lib/ransack/adapters/mongoid/ransack/context.rb +0 -60
  109. data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +0 -27
  110. data/lib/ransack/adapters/mongoid/ransack/translate.rb +0 -13
  111. data/lib/ransack/adapters/mongoid/ransack/visitor.rb +0 -24
  112. data/lib/ransack/adapters/mongoid/table.rb +0 -35
  113. data/lib/ransack/adapters/mongoid.rb +0 -13
  114. data/spec/mongoid/adapters/mongoid/base_spec.rb +0 -276
  115. data/spec/mongoid/adapters/mongoid/context_spec.rb +0 -56
  116. data/spec/mongoid/configuration_spec.rb +0 -102
  117. data/spec/mongoid/dependencies_spec.rb +0 -8
  118. data/spec/mongoid/helpers/ransack_helper.rb +0 -11
  119. data/spec/mongoid/nodes/condition_spec.rb +0 -34
  120. data/spec/mongoid/nodes/grouping_spec.rb +0 -13
  121. data/spec/mongoid/predicate_spec.rb +0 -155
  122. data/spec/mongoid/search_spec.rb +0 -446
  123. data/spec/mongoid/support/mongoid.yml +0 -6
  124. data/spec/mongoid/support/schema.rb +0 -128
  125. data/spec/mongoid/translate_spec.rb +0 -14
  126. data/spec/mongoid_spec_helper.rb +0 -59
  127. data/spec/ransack/dependencies_spec.rb +0 -12
data/CHANGELOG.md CHANGED
@@ -1,9 +1,458 @@
1
1
  # Change Log
2
2
 
3
- ## Unreleased
3
+ * Add `ActiveRecord::Base.ransack!` which raises error if passed unknown condition
4
4
 
5
+ *Aaron Lipman*
6
+
7
+ ## 2.4.0 - 2020-11-27
8
+
9
+ *
10
+ PR []()
11
+
12
+ * Support ActiveRecord 6.1.0.rc1.
13
+ PR [1172](https://github.com/activerecord-hackery/ransack/pull/1172)
14
+
15
+ * Fix for ActiveRecord 5.2.4 (note security fix in 5.2.4.2 for ActiveView's escape_javascript CVE-2020-5267 for all earlier versions)
16
+
17
+ * Drop support for ActiveRecord older than 5.2.4.
18
+ PR [1166](https://github.com/activerecord-hackery/ransack/pull/1166)
19
+
20
+ ## 2.3.2 - 2020-01-11
21
+
22
+ * Breakfix to bump Polyamorous
23
+
24
+ ## 2.3.1 - 2020-01-11
25
+
26
+ * Drop support for Active Record 5.0, 5.1, and 5.2.0.
27
+ PR [#1073](https://github.com/activerecord-hackery/ransack/pull/1073)
28
+
29
+ * Drop support for rubies under 2.3.
30
+ PR [#1070](https://github.com/activerecord-hackery/ransack/pull/1070)
31
+
32
+ ... and others
33
+
34
+ ## 2.3.0 - 2019-08-18
35
+
36
+ * Arabic translations PR [979](https://github.com/activerecord-hackery/ransack/pull/979)
37
+
38
+ * Rails 6 PR [1027](https://github.com/activerecord-hackery/ransack/pull/1027)
39
+ *vrodokanakis*
40
+
41
+ * Make polyamorous a separate gem PR [1002](https://github.com/activerecord-hackery/ransack/pull/1002)
42
+
43
+ * Catalan translations PR[1007](https://github.com/activerecord-hackery/ransack/pull/1007)
44
+ *roslavych*
45
+
46
+ * Don't escape period characters with wildcard searches in mysql2 PR [1013](https://github.com/activerecord-hackery/ransack/pull/1013)
47
+ *daflip*
48
+
49
+ * Farsi translations PR [1030](https://github.com/activerecord-hackery/ransack/pull/1030)
50
+
51
+ * Finnish translations PR [1049](https://github.com/activerecord-hackery/ransack/pull/1049)
52
+
53
+ * Fix wrong table alias when using nested join. for ActiveRecord >= 5.2
54
+ PR [374](https://github.com/activerecord-hackery/ransack/pull/374)
55
+
56
+ *hiichan*
57
+
58
+ ## Version 2.1.1 - 2018-12-05
59
+
60
+ * Add `arabic` translation
61
+ https://github.com/activerecord-hackery/ransack/pull/979
62
+
63
+ * Deprecate #search
64
+ PR [975](https://github.com/activerecord-hackery/ransack/pull/975)
65
+
66
+ ## Version 2.1.0 - 2018-10-26
67
+
68
+ * Add support for sorting by scopes
69
+ PR [973](https://github.com/activerecord-hackery/ransack/pull/973)
70
+
71
+ *Diego Borges*
72
+
73
+ * Added a new logo for Ransack
74
+ PR [972](https://github.com/activerecord-hackery/ransack/pull/972)
75
+
76
+ *Anıl Kılıç*, *Greg Molnar*
77
+
78
+ * Greek translations
79
+ PR [971](https://github.com/activerecord-hackery/ransack/pull/971)
80
+ PR [960](https://github.com/activerecord-hackery/ransack/pull/960)
81
+
82
+ *Sean Carroll*, *Greg Molnar*
83
+
84
+ * README improvements
85
+ PR [963](https://github.com/activerecord-hackery/ransack/pull/963)
86
+
87
+ *tommaso1*
88
+
89
+ * Bulgarian translations
90
+ PR [961](https://github.com/activerecord-hackery/ransack/pull/961)
91
+
92
+ *Sean Carroll*
93
+
94
+ * README improvements
95
+ PR [956](https://github.com/activerecord-hackery/ransack/pull/956)
96
+
97
+ *Alex Konoval*
98
+
99
+ * Remove lib/ransack/adapters/active_record/compat.rb
100
+ PR [954](https://github.com/activerecord-hackery/ransack/pull/954)
101
+
102
+ *Ryuta Kamizono*
103
+
104
+ * Remove unused aliases
105
+ PR [953](https://github.com/activerecord-hackery/ransack/pull/953)
106
+
107
+ *Ryuta Kamizono*
108
+
109
+ ## Version 2.0.1 - 2018-08-18
110
+
111
+ * Don't return association if table is nil
112
+ PR [952](https://github.com/activerecord-hackery/ransack/pull/952)
113
+
114
+ *Christian Gregg*
115
+
116
+ ## Version 2.0.0 - 2018-08-09
117
+
118
+ * Add support for Active Record 5.2.1
119
+ PR [#938](https://github.com/activerecord-hackery/ransack/pull/938)
120
+
121
+ * Fix sort with joins on existing association
122
+ PR [#937](https://github.com/activerecord-hackery/ransack/pull/937)
123
+
124
+ * Add the ability to skip arg sanitization on a per scope basis. Using
125
+ `ransackable_scopes_skip_sanitize_args`, users can define a list of
126
+ scopes which will bypass parameter sanitization. This allows passing 0,
127
+ 1, t, f, etc. to a scope as an actual parameter.
128
+ PR [#933](https://github.com/activerecord-hackery/ransack/pull/933)
129
+
130
+ * Drop support for Active Record < 5.0.
131
+ PR [#929](https://github.com/activerecord-hackery/ransack/pull/929)
132
+
133
+ * Extract mongoid support to a separate gem.
134
+ PR [#928](https://github.com/activerecord-hackery/ransack/pull/928)
135
+
136
+ * Absorb polyamorous
137
+ PR [#927](https://github.com/activerecord-hackery/ransack/pull/927)
138
+
139
+ * Fix broken monkey patch of #form_with
140
+ PR [#922](https://github.com/activerecord-hackery/ransack/pull/922)
141
+
142
+ ## Version 1.8.8 - 2018-03-16
143
+ * Fix multiple database support
144
+ PR [#893](https://github.com/activerecord-hackery/ransack/pull/893)
145
+
146
+ * Updated Dutch translations
147
+ PR [#887](https://github.com/activerecord-hackery/ransack/pull/887)
148
+
149
+ * Fixed no method error 'asc' for Rails 4.2
150
+ PR [#885](https://github.com/activerecord-hackery/ransack/pull/885)
151
+
152
+
153
+ ## Version 1.8.7 - 2018-02-05
154
+
155
+ * Rails 5.2 support
156
+ PR [#868](https://github.com/activerecord-hackery/ransack/pull/868)
157
+
158
+ * Lock pg gem to 0.21 to support older releases
159
+
160
+ * Warnings cleanup
161
+ PR [#867](https://github.com/activerecord-hackery/ransack/pull/867)
162
+
163
+ * Wildcard escaping
164
+ PR [#866]
165
+
166
+ ## Version 1.8.6 - 2018-01-23
167
+
168
+ ### Added
169
+
170
+ * Improve memory usage
171
+ PR [#820](https://github.com/activerecord-hackery/ransack/pull/820)
172
+
173
+ * Bump Polyamorous version to 1.3.2
174
+ PR [#858](https://github.com/activerecord-hackery/ransack/pull/858)
175
+
176
+ ## Version 1.8.5
177
+
178
+ ### Added
179
+
180
+ * Added Turkish Translations
181
+ PR [#835](https://github.com/activerecord-hackery/ransack/issues/835).
182
+
183
+ ## Version 1.8.4 - 2017-10-09
184
+
185
+ ### Added
186
+
187
+ * Added italian translations.
188
+ PR [#833](https://github.com/activerecord-hackery/ransack/pull/833).
189
+
190
+ * Add an optional default arrow for unsorted fields.
191
+ PR [#816](https://github.com/activerecord-hackery/ransack/pull/816/files).
192
+
193
+ ### Fixed
194
+
195
+ * Cast Postgres money type to float.
196
+ PR [#823](https://github.com/activerecord-hackery/ransack/pull/823).
197
+
198
+ * Fix the bug in sort_link, which causes the multiple fields option to be
199
+ ignored when block parameter is specified.
200
+ PR [#818](https://github.com/activerecord-hackery/ransack/pull/818).
201
+
202
+ * No need pass some arugments to JoinAssociation#join_constraints in Rails 5.1.
203
+ PR [#814](https://github.com/activerecord-hackery/ransack/pull/814).
204
+ Fixes [#807](https://github.com/activerecord-hackery/ransack/issues/807).
205
+ Reference [rails/rails#28267](https://github.com/rails/rails/pull/28267)
206
+ and [rails/rails#27851](https://github.com/rails/rails/pull/27851).
207
+
208
+ ## Version 1.8.3 - 2017-06-15
209
+
210
+ ### Added
211
+
212
+ * Add a config option to customize the up and down arrows used for direction
213
+ indicators in Ransack sort links.
214
+ PR [#726](https://github.com/activerecord-hackery/ransack/pull/726).
215
+
216
+ *Garett Arrowood*
217
+
218
+ * Add ability to turn off sanitization of custom scope arguments.
219
+ PR [#742](https://github.com/activerecord-hackery/ransack/pull/742).
220
+
221
+ *Garett Arrowood*
222
+
223
+ ### Fixed
224
+
225
+ * Use class attributes properly so that inheritance is respected.
226
+ PR [#717](https://github.com/activerecord-hackery/ransack/pull/717).
227
+ This fixes two bugs:
228
+
229
+ 1. In the Mongoid adapter, subclasses were not properly inheriting their
230
+ parents' Ransack aliases because each class defined its own set of
231
+ aliases.
232
+
233
+ 2. In the Active Record adapter, Ransack aliases were defined in such a way
234
+ that the parent's (and grandparent's, etc.) aliases were overwritten by
235
+ the child, meaning that all aliases were ultimately kept on
236
+ `ActiveRecord::Base`. This had the unfortunate effect of enforcing
237
+ uniqueness of Ransack alias names across all models rather than per
238
+ model. Depending on the load order of models, earlier definitions of an
239
+ alias in other models were clobbered.
240
+
241
+ *Steve Richert (laserlemon)*
242
+
243
+ * Use `ActiveSupport.on_load` hooks to include Ransack in Active Record,
244
+ avoiding autoloading the constant too soon. PR
245
+ [#719](https://github.com/activerecord-hackery/ransack/pull/719). Reference:
246
+ [This comment in rails#23589]
247
+ (https://github.com/rails/rails/issues/23589#issuecomment-229247727).
248
+
249
+ *Yuji Yaginuma (y-yagi)*
250
+
251
+ ## Version 1.8.2 - 2016-08-08
252
+ ### Fixed
253
+
254
+ * Fix empty attribute_fields regression in advanced search mode introduced by
255
+ [235eae3](https://github.com/activerecord-hackery/ransack/commit/235eae3).
256
+ Closes
257
+ [#701](https://github.com/activerecord-hackery/ransack/issues/701). Commit
258
+ [2839acf](https://github.com/activerecord-hackery/ransack/commit/2839acf).
259
+
260
+ *Jon Atack, Jay Dorsey, Stefan Haslinger, Igor Kasyanchuk*
261
+
262
+ ### Added
263
+
264
+ * Add `sort_url` view helper that returns only the url of a `sort_link`. PR
265
+ [#706](https://github.com/activerecord-hackery/ransack/pull/706).
266
+
267
+ *amatotsuji*
268
+
269
+ ## Version 1.8.1 - 2016-07-27
270
+ ### Fixed
271
+
272
+ * Fix `rake console` to run a command-line console with ransack + seed data.
273
+ Commits
274
+ [2cc781e](https://github.com/activerecord-hackery/ransack/commit/2cc781e),
275
+ [f2e85ad](https://github.com/activerecord-hackery/ransack/commit/f2e85ad),
276
+ [6a059ba](https://github.com/activerecord-hackery/ransack/commit/6a059ba).
277
+
278
+ *Jon Atack*
279
+
280
+ * Fix returned value of `Ransack::Nodes::Condition#format_predicate`. PR
281
+ [#692](https://github.com/activerecord-hackery/ransack/pull/692).
282
+
283
+ *Masahiro Saito*
284
+
285
+ * Better test coverage on passing arrays to ransackers. Commit
286
+ [98df2c5](https://github.com/activerecord-hackery/ransack/commit/98df2c5).
287
+
288
+ *Jon Atack*
289
+
290
+ * Fix missing Ransack::Constants::ASC constant. Commit
291
+ [aece23c](https://github.com/activerecord-hackery/ransack/commit/aece23c).
292
+
293
+ *Jon Atack*
294
+
295
+ ### Changed
296
+
297
+ * Replace arrow constants with frozen strings in public methods. Commits
298
+ [c0dff33](https://github.com/activerecord-hackery/ransack/commit/c0dff33),
299
+ [e489ca7](https://github.com/activerecord-hackery/ransack/commit/e489ca7).
300
+
301
+ *Jon Atack*
302
+
303
+ ## Version 1.8.0 - 2016-07-14
304
+ ### Added
305
+
306
+ * Support Mongoid 5. PR [#636](https://github.com/activerecord-hackery/ransack/pull/636), commit
307
+ [9e5faf4](https://github.com/activerecord-hackery/ransack/commit/9e5faf4).
308
+
309
+ *Josef Šimánek*
310
+
311
+ * Add optional block argument for the `sort_link` method. PR
312
+ [#604](https://github.com/activerecord-hackery/ransack/pull/604).
313
+
314
+ *Andrea Dal Ponte*
315
+
316
+ * Add `ransack_alias` to allow users to customize the names for long
317
+ ransack field names. PR
318
+ [#623](https://github.com/activerecord-hackery/ransack/pull/623).
319
+
320
+ *Ray Zane*
321
+
322
+ * Add support for searching on attributes that have been added to
323
+ Active Record models with `alias_attribute` (Rails >= 4 only). PR
324
+ [#592](https://github.com/activerecord-hackery/ransack/pull/592), commit
325
+ [549342a](https://github.com/activerecord-hackery/ransack/commit/549342a).
326
+
327
+ *Marten Schilstra*
328
+
329
+ * Add ability to globally hide sort link order indicator arrows with
330
+ `Ransack.configure#hide_sort_order_indicators = true`. PR
331
+ [#577](https://github.com/activerecord-hackery/ransack/pull/577), commit
332
+ [95d4591](https://github.com/activerecord-hackery/ransack/commit/95d4591).
333
+
334
+ *Josh Hunter*, *Jon Atack*
335
+
336
+ * Add test for `ActionController:Parameter` object params in `sort_link` to
337
+ ensure Ransack is handling the Rails 5 changes correctly. Commit
338
+ [b1cfed8](https://github.com/activerecord-hackery/ransack/commit/b1cfed8).
339
+
340
+ *Ryan Wood*
341
+
342
+ * Add failing tests to facilitate work on issue
343
+ [#566](https://github.com/activerecord-hackery/ransack/issues/566)
344
+ of passing boolean values to search scopes. PR
345
+ [#575](https://github.com/activerecord-hackery/ransack/pull/575).
346
+
347
+ *Marcel Eeken*
348
+
349
+ * Add i18n locale files:
350
+ * Taiwanese Hokkien/Mandarin (`zh-TW.yml`). PR
351
+ [#674](https://github.com/activerecord-hackery/ransack/pull/674). *Sibevin Wang*
352
+ * Danish (`da.yml`). PR
353
+ [#663](https://github.com/activerecord-hackery/ransack/pull/663). *Kasper Johansen*
354
+ * Brazilian Portuguese (`pt-BR.yml`). PR
355
+ [#581](https://github.com/activerecord-hackery/ransack/pull/581). *Diego Henrique Domingues*
356
+ * Indonesian (Bahasa) (`id.yml`). PR
357
+ [#612](https://github.com/activerecord-hackery/ransack/pull/612). *Adam Pahlevi Baihaqi*
358
+ * Japanese (`ja.yml`). PR
359
+ [#622](https://github.com/activerecord-hackery/ransack/pull/622). *Masanobu Mizutani*
360
+
361
+ ### Fixed
362
+
363
+ * In `FormHelper::SortLink#parameters_hash`, convert `params#to_unsafe_h`
364
+ only if Rails 5, and add tests. Commit
365
+ [14e66ca](https://github.com/activerecord-hackery/ransack/commit/14e66ca).
366
+
367
+ *Jon Atack*
368
+
369
+ * Respect negative conditions for collection associations and fix Mongoid
370
+ compat. PR [#645](https://github.com/activerecord-hackery/ransack/pull/645).
371
+
372
+ *Andrew Vit*
373
+
374
+ * Ensure conditions differing only by ransacker_args aren't filtered out.
375
+ PR [#665](https://github.com/activerecord-hackery/ransack/pull/665).
376
+
377
+ *Andrew Porterfield*
378
+
379
+ * Fix using aliased attributes in association searches, and add a failing
380
+ spec. PR [#602](https://github.com/activerecord-hackery/ransack/pull/602).
381
+
382
+ *Marten Schilstra*
383
+
384
+ * Replace Active Record `table_exists?` API that was deprecated
385
+ [here](https://github.com/rails/rails/commit/152b85f) in Rails 5. Commit
386
+ [c9d2297](https://github.com/activerecord-hackery/ransack/commit/c9d2297).
387
+
388
+ *Jon Atack*
389
+
390
+ * Adapt to changes in Rails 5 where AC::Parameters composes a HWIA instead of
391
+ inheriting from Hash starting from Rails commit rails/rails@14a3bd5. Commit
392
+ [ceafc05](https://github.com/activerecord-hackery/ransack/commit/ceafc05).
393
+
394
+ *Jon Atack*
395
+
396
+ * Fix test `#sort_link with hide order indicator set to true` to fail properly
397
+ ([4f65b09](https://github.com/activerecord-hackery/ransack/commit/4f65b09)).
398
+ This spec, added in
399
+ [#473](https://github.com/activerecord-hackery/ransack/pull/473), tested
400
+ the presence of the attribute name instead of the absence of the order
401
+ indicators and did not fail when it should.
402
+
403
+ *Josh Hunter*, *Jon Atack*
404
+
405
+ * Fix rspec-mocks `stub` deprecation warnings when running the tests. Commit
406
+ [600892e](https://github.com/activerecord-hackery/ransack/commit/600892e).
407
+
408
+ *Jon Atack*
409
+
410
+ * Revert
411
+ [f858dd6](https://github.com/activerecord-hackery/ransack/commit/f858dd6).
412
+ Fixes [#553](https://github.com/activerecord-hackery/ransack/issues/553)
413
+ performance regression with the SQL Server adapter.
414
+
415
+ *sschwing3*
416
+
417
+ * Fix invalid Chinese I18n locale file name by replacing "zh" with "zh-CN".
418
+ PR [#590](https://github.com/activerecord-hackery/ransack/pull/590).
419
+
420
+ *Ethan Yang*
421
+
422
+ ### Changed
423
+
424
+ * Memory/speed perf improvement: Freeze strings in array global constants and
425
+ partially move from using global string constants to frozen strings
426
+ ([381a83c](https://github.com/activerecord-hackery/ransack/commit/381a83c)
427
+ and
428
+ [ce114ec](https://github.com/activerecord-hackery/ransack/commit/ce114ec)).
429
+
430
+ *Jon Atack*
431
+
432
+ * Escape underscore `_` wildcard characters with PostgreSQL and MySQL. PR
433
+ [#584](https://github.com/activerecord-hackery/ransack/issues/584).
434
+
435
+ *Igor Dobryn*
436
+
437
+ * Refactor `Ransack::Adapters` from conditionals to classes
438
+ ([94a404c](https://github.com/activerecord-hackery/ransack/commit/94a404c)).
439
+
440
+ *Jon Atack*
5
441
 
6
442
  ## Version 1.7.0 - 2015-08-20
443
+ ### Added
444
+
445
+ * Add Mongoid support for referenced/embedded relations. PR
446
+ [#498](https://github.com/activerecord-hackery/ransack/pull/498).
447
+ TODO: Missing spec coverage! Add documentation!
448
+
449
+ *Penn Su*
450
+
451
+ * Add German i18n locale file (`de.yml`). PR
452
+ [#537](https://github.com/activerecord-hackery/ransack/pull/537).
453
+
454
+ *Philipp Weissensteiner*
455
+
7
456
  ### Fixed
8
457
 
9
458
  * Fix
@@ -44,8 +493,8 @@
44
493
 
45
494
  *Andrew Vit*
46
495
 
47
- * Fix RSpec `its` method deprecation warning: 'Use of rspec-core's `its`
48
- method is deprecated. Use the rspec-its gem instead
496
+ * Fix RSpec `its` method deprecation warning: "Use of rspec-core's its
497
+ method is deprecated. Use the rspec-its gem instead"
49
498
  ([c09aa17](https://github.com/activerecord-hackery/ransack/commit/c09aa17)).
50
499
 
51
500
  * Fix deprecated RSpec syntax in `grouping_spec.rb`
@@ -53,24 +502,11 @@
53
502
 
54
503
  *Jon Atack*
55
504
 
56
- ### Added
57
-
58
- * Add Mongoid support for referenced/embedded relations. PR
59
- [#498](https://github.com/activerecord-hackery/ransack/pull/498).
60
- TODO: Missing spec coverage! Add documentation!
61
-
62
- *Penn Su*
63
-
64
- * Add German locale file (de.yml). PR
65
- [#537](https://github.com/activerecord-hackery/ransack/pull/537).
66
-
67
- *Philipp Weissensteiner*
68
-
69
505
  ### Changed
70
506
 
71
507
  * Upgrade gemspec dependencies: MySQL2 from '0.3.14' to '0.3.18', and RSpec
72
508
  from '~> 2.14.0' to '~> 2' which loads 2.99
73
- ([000cd2](https://github.com/activerecord-hackery/ransack/commit/000cd2)).
509
+ ([000cd22](https://github.com/activerecord-hackery/ransack/commit/000cd22)).
74
510
 
75
511
  * Upgrade spec suite to RSpec 3 `expect` syntax backward compatible with
76
512
  RSpec 2.9
@@ -89,10 +525,12 @@
89
525
 
90
526
 
91
527
  ## Version 1.6.6 - 2015-04-05
92
- ### Changed
528
+ ### Added
93
529
 
94
- * Upgrade Polyamorous dependency to version 1.2.0, which uses `Module#prepend`
95
- instead of `alias_method` for hooking into Active Record (with Ruby 2.x).
530
+ * Add the Ruby version to the the header message that shows the database,
531
+ Active Record and Arel versions when running tests.
532
+
533
+ * Add Code Climate analysis.
96
534
 
97
535
  *Jon Atack*
98
536
 
@@ -117,12 +555,10 @@
117
555
 
118
556
  *Jon Atack*
119
557
 
120
- ### Added
121
-
122
- * Add the Ruby version to the the header message that shows the database,
123
- Active Record and Arel versions when running tests.
558
+ ### Changed
124
559
 
125
- * Add Code Climate analysis.
560
+ * Upgrade Polyamorous dependency to version 1.2.0, which uses `Module#prepend`
561
+ instead of `alias_method` for hooking into Active Record (with Ruby 2.x).
126
562
 
127
563
  *Jon Atack*
128
564
 
@@ -239,7 +675,7 @@
239
675
 
240
676
  *Josh Kovach*
241
677
 
242
- * Add an sort_link option to not display sort direction arrows
678
+ * Add an sort_link option to not display sort order indicator arrows
243
679
  ([PR #473](https://github.com/activerecord-hackery/ransack/pull/473)).
244
680
 
245
681
  *Fred Bergman*
@@ -427,7 +863,7 @@
427
863
 
428
864
  *Pedro Chambino*
429
865
 
430
- * Add `ro.yml` Romanian translation file.
866
+ * Add Romanian i18n locale file (`ro.yml`).
431
867
 
432
868
  *Andreas Philippi*
433
869
 
data/CONTRIBUTING.md CHANGED
@@ -5,15 +5,15 @@ effective for everyone involved!
5
5
 
6
6
  Ransack is an open source project and we encourage contributions.
7
7
 
8
+ Please do not use the issue tracker for personal support requests. Stack
9
+ Overflow is a better place for that where a wider community can help you!
10
+
8
11
  ## Filing an issue
9
12
 
10
13
  Good issue reports are extremely helpful! Please only open an issue if a bug
11
14
  is caused by Ransack, is new (has not already been reported), and can be
12
15
  reproduced from the information you provide.
13
16
 
14
- Please do not use the issue tracker personal support requests. Stack Overflow
15
- is a better place for that where a wider community can help you.
16
-
17
17
  Steps:
18
18
 
19
19
  1. **Use the GitHub issue search** &mdash; check if the issue has already been
@@ -22,18 +22,25 @@ Steps:
22
22
  2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
23
23
  `master` branch in the repository.
24
24
 
25
- 3. **Isolate and report the problem** &mdash; ideally create a reduced test
26
- case.
25
+ 3. **Isolate the real problem** &mdash; make sure the issue is really a bug in
26
+ Ransack and not in your code or another gem.
27
27
 
28
- When filing an issue, please provide these details:
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
31
+ these code examples as a bug-report template for your Ransack issue!
29
32
 
30
- * A comprehensive list of steps to reproduce the issue :smiley: or even better, a failing spec!
31
- * The versions of Ruby, Rails, Ransack and your operating system and database.
33
+ If you do not provide a self-contained gist and would like your issue to be reviewed, do provide at a minimum:
34
+
35
+ * A comprehensive list of steps to reproduce the issue, or even better, a
36
+ passing/failing test spec.
37
+ * Whether you are using Ransack through another gem like ActiveAdmin,
38
+ SimpleForm, etc.
39
+ * The versions of Ruby, Rails, Ransack and the database.
32
40
  * Any relevant stack traces ("Full trace" preferred).
33
41
 
34
- Any issue that is open for 14 days without actionable information or activity
35
- will be marked as "stalled" and then closed. Stalled issues can be re-opened
36
- if actionable information to reproduce the issue is provided.
42
+ Issues filed without the above information or that remain open without activity
43
+ for 14 days will be closed. They can be re-opened if actionable information to reproduce the issue is provided.
37
44
 
38
45
  ## Pull requests
39
46
 
@@ -57,6 +64,9 @@ Here's a quick guide:
57
64
  2. Create a thoughtfully-named branch for your changes (`git checkout -b my-new-feature`).
58
65
 
59
66
  3. Install the development dependencies by running `bundle install`.
67
+ To install rails other than latest (set in Gemfile): `RAILS='5-2-stable' bundle install`
68
+
69
+ $ RAILS='5-2-stable' bundle install
60
70
 
61
71
  4. Begin by running the tests. We only take pull requests with passing tests,
62
72
  and it's great to know that you have a clean slate:
@@ -65,11 +75,30 @@ Here's a quick guide:
65
75
 
66
76
  The test suite runs by default with SQLite3. To run the test suite with PostgreSQL or MySQL, use:
67
77
 
68
- $ DB=postgresql bundle exec rake spec (`DB=pg` & `DB=postgres` work too)
78
+ $ DB=pg bundle exec rake spec (`DB=postgres` & `DB=postgresql` work too)
69
79
  $ DB=mysql bundle exec rake spec
70
80
 
71
- 5. Hack away! Please use Ruby features that are compatible down to Ruby 1.9.
72
- Since version 1.5, Ransack no longer maintains Ruby 1.8 compatibility.
81
+ For Postgres and MySQL, databases are expected to exist, called 'ransack'. To create use these commands (assuming OS X and Homebrew):
82
+
83
+ ### Postgres
84
+ $ createdb ransack
85
+
86
+ ### MySQL
87
+ $ mysql -u root
88
+ mysql> create database ransack;
89
+
90
+ The test suite runs by default
91
+
92
+ To run only the tests in a particular file: `bundle exec rspec <path/to/filename>`
93
+
94
+ $ bundle exec rspec spec/ransack/search_spec.rb
95
+
96
+ To run a single test in that file: `bundle exec rspec <path/to/filename> -e "test name"`
97
+
98
+ $ bundle exec rspec spec/ransack/search_spec.rb -e "accepts a context option"
99
+
100
+ 5. Hack away! Please use Ruby features that are compatible down to Ruby 2.3.
101
+ Since version 2.3.1, Ransack no longer maintains Ruby 2.2 compatibility.
73
102
 
74
103
  6. Add tests for your changes. Only refactoring and documentation changes
75
104
  require no new tests. If you are adding functionality or fixing a bug, we
@@ -80,20 +109,21 @@ Here's a quick guide:
80
109
  8. Update the Change Log. If you are adding new functionality, document it in
81
110
  the README.
82
111
 
83
- 9. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
112
+ 9. Make sure git knows your name and email address in your `~/.gitconfig` file:
84
113
 
85
- 10. If necessary, rebase your commits into logical chunks, without errors. To
114
+ $ git config --global user.name "Your Name"
115
+ $ git config --global user.email "contributor@example.com"
116
+
117
+ 10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
118
+
119
+ 11. If necessary, rebase your commits into logical chunks, without errors. To
86
120
  interactively rebase and cherry-pick from, say, the last 10 commits:
87
121
  `git rebase -i HEAD~10`, then `git push -f`.
88
122
 
89
- 11. Push the branch up to your fork on Github
90
- (`git push origin my-new-feature`) and from Github submit a pull request to
123
+ 12. Push the branch up to your fork on GitHub
124
+ (`git push origin my-new-feature`) and from GitHub submit a pull request to
91
125
  Ransack's `master` branch.
92
126
 
93
- 12. If your pull request only contains documentation changes, please remember
94
- to add `[skip ci]` to the beginning of your commit message so the Travis
95
- test suite doesn't :runner: needlessly.
96
-
97
127
  At this point you're waiting on us. We like to at least comment on, if not
98
128
  accept, pull requests within three business days (and, typically, one business
99
129
  day). We may suggest some changes or improvements or alternatives.