ransack 1.6.6 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -0
  3. data/.travis.yml +35 -53
  4. data/CHANGELOG.md +530 -9
  5. data/CONTRIBUTING.md +63 -26
  6. data/Gemfile +24 -24
  7. data/README.md +371 -96
  8. data/Rakefile +6 -29
  9. data/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +24 -0
  10. data/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +79 -0
  11. data/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +11 -0
  12. data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +1 -0
  13. data/lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb +80 -0
  14. data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +1 -0
  15. data/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +74 -0
  16. data/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +93 -0
  17. data/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +1 -0
  18. data/lib/polyamorous/join.rb +70 -0
  19. data/lib/polyamorous/polyamorous.rb +24 -0
  20. data/lib/polyamorous/swapping_reflection_class.rb +11 -0
  21. data/lib/polyamorous/tree_node.rb +7 -0
  22. data/lib/ransack/adapters/active_record/base.rb +23 -2
  23. data/lib/ransack/adapters/active_record/context.rb +206 -139
  24. data/lib/ransack/adapters/active_record/ransack/constants.rb +70 -55
  25. data/lib/ransack/adapters/active_record/ransack/context.rb +10 -18
  26. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +43 -36
  27. data/lib/ransack/adapters/active_record/ransack/translate.rb +1 -5
  28. data/lib/ransack/adapters/active_record/ransack/visitor.rb +23 -0
  29. data/lib/ransack/adapters/active_record.rb +11 -10
  30. data/lib/ransack/adapters.rb +64 -0
  31. data/lib/ransack/configuration.rb +91 -4
  32. data/lib/ransack/constants.rb +13 -26
  33. data/lib/ransack/context.rb +45 -40
  34. data/lib/ransack/helpers/form_builder.rb +21 -12
  35. data/lib/ransack/helpers/form_helper.rb +99 -69
  36. data/lib/ransack/locale/ar.yml +70 -0
  37. data/lib/ransack/locale/az.yml +70 -0
  38. data/lib/ransack/locale/bg.yml +70 -0
  39. data/lib/ransack/locale/ca.yml +70 -0
  40. data/lib/ransack/locale/da.yml +70 -0
  41. data/lib/ransack/locale/de.yml +70 -0
  42. data/lib/ransack/locale/el.yml +70 -0
  43. data/lib/ransack/locale/es.yml +22 -22
  44. data/lib/ransack/locale/fa.yml +70 -0
  45. data/lib/ransack/locale/fi.yml +71 -0
  46. data/lib/ransack/locale/id.yml +70 -0
  47. data/lib/ransack/locale/it.yml +70 -0
  48. data/lib/ransack/locale/ja.yml +70 -0
  49. data/lib/ransack/locale/nl.yml +4 -4
  50. data/lib/ransack/locale/pt-BR.yml +70 -0
  51. data/lib/ransack/locale/ru.yml +70 -0
  52. data/lib/ransack/locale/sk.yml +70 -0
  53. data/lib/ransack/locale/tr.yml +70 -0
  54. data/lib/ransack/locale/{zh.yml → zh-CN.yml} +13 -13
  55. data/lib/ransack/locale/zh-TW.yml +70 -0
  56. data/lib/ransack/nodes/attribute.rb +6 -3
  57. data/lib/ransack/nodes/bindable.rb +18 -6
  58. data/lib/ransack/nodes/condition.rb +85 -24
  59. data/lib/ransack/nodes/grouping.rb +17 -11
  60. data/lib/ransack/nodes/sort.rb +9 -5
  61. data/lib/ransack/nodes/value.rb +74 -68
  62. data/lib/ransack/nodes.rb +2 -3
  63. data/lib/ransack/predicate.rb +17 -20
  64. data/lib/ransack/search.rb +15 -15
  65. data/lib/ransack/translate.rb +115 -115
  66. data/lib/ransack/version.rb +1 -1
  67. data/lib/ransack/visitor.rb +1 -12
  68. data/lib/ransack.rb +11 -17
  69. data/logo/ransack-h.png +0 -0
  70. data/logo/ransack-h.svg +34 -0
  71. data/logo/ransack-v.png +0 -0
  72. data/logo/ransack-v.svg +34 -0
  73. data/logo/ransack.png +0 -0
  74. data/logo/ransack.svg +21 -0
  75. data/ransack.gemspec +9 -27
  76. data/spec/console.rb +4 -0
  77. data/spec/helpers/polyamorous_helper.rb +19 -0
  78. data/spec/polyamorous/join_association_spec.rb +35 -0
  79. data/spec/polyamorous/join_dependency_spec.rb +97 -0
  80. data/spec/polyamorous/join_spec.rb +19 -0
  81. data/spec/ransack/adapters/active_record/base_spec.rb +380 -91
  82. data/spec/ransack/adapters/active_record/context_spec.rb +72 -33
  83. data/spec/ransack/configuration_spec.rb +87 -14
  84. data/spec/ransack/helpers/form_builder_spec.rb +2 -11
  85. data/spec/ransack/helpers/form_helper_spec.rb +481 -113
  86. data/spec/ransack/nodes/condition_spec.rb +25 -1
  87. data/spec/ransack/nodes/grouping_spec.rb +62 -6
  88. data/spec/ransack/predicate_spec.rb +79 -5
  89. data/spec/ransack/search_spec.rb +159 -79
  90. data/spec/spec_helper.rb +8 -0
  91. data/spec/support/schema.rb +99 -37
  92. metadata +57 -184
  93. data/lib/ransack/adapters/active_record/3.0/compat.rb +0 -179
  94. data/lib/ransack/adapters/active_record/3.0/context.rb +0 -205
  95. data/lib/ransack/adapters/active_record/3.1/context.rb +0 -219
  96. data/lib/ransack/adapters/active_record/3.2/context.rb +0 -44
  97. data/lib/ransack/adapters/active_record/compat.rb +0 -14
  98. data/lib/ransack/adapters/mongoid/3.2/.gitkeep +0 -0
  99. data/lib/ransack/adapters/mongoid/attributes/attribute.rb +0 -37
  100. data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +0 -17
  101. data/lib/ransack/adapters/mongoid/attributes/predications.rb +0 -141
  102. data/lib/ransack/adapters/mongoid/base.rb +0 -126
  103. data/lib/ransack/adapters/mongoid/context.rb +0 -208
  104. data/lib/ransack/adapters/mongoid/inquiry_hash.rb +0 -23
  105. data/lib/ransack/adapters/mongoid/ransack/constants.rb +0 -88
  106. data/lib/ransack/adapters/mongoid/ransack/context.rb +0 -60
  107. data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +0 -27
  108. data/lib/ransack/adapters/mongoid/ransack/translate.rb +0 -13
  109. data/lib/ransack/adapters/mongoid/ransack/visitor.rb +0 -24
  110. data/lib/ransack/adapters/mongoid/table.rb +0 -35
  111. data/lib/ransack/adapters/mongoid.rb +0 -13
  112. data/spec/mongoid/adapters/mongoid/base_spec.rb +0 -276
  113. data/spec/mongoid/adapters/mongoid/context_spec.rb +0 -56
  114. data/spec/mongoid/configuration_spec.rb +0 -102
  115. data/spec/mongoid/dependencies_spec.rb +0 -8
  116. data/spec/mongoid/helpers/ransack_helper.rb +0 -11
  117. data/spec/mongoid/nodes/condition_spec.rb +0 -34
  118. data/spec/mongoid/nodes/grouping_spec.rb +0 -13
  119. data/spec/mongoid/predicate_spec.rb +0 -155
  120. data/spec/mongoid/search_spec.rb +0 -446
  121. data/spec/mongoid/support/mongoid.yml +0 -6
  122. data/spec/mongoid/support/schema.rb +0 -128
  123. data/spec/mongoid/translate_spec.rb +0 -14
  124. data/spec/mongoid_spec_helper.rb +0 -59
  125. data/spec/ransack/dependencies_spec.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3d0f75469674a840fd6677c3e2cea940c84e4438
4
- data.tar.gz: 6ab05dd928c897263c629de60c06dfb10fc74ea5
2
+ SHA256:
3
+ metadata.gz: f5cd517575121b1f2c1041501645a95680a4efbe82c0b2d6c74e079d080cda29
4
+ data.tar.gz: f927c47bfc28f15d7a24eb2761ae1d003ff18912c1c91e7716ed2628f9012ccc
5
5
  SHA512:
6
- metadata.gz: a46b017f203b3581ba2349417891e6f3733f3a49aa2c843daa748d69fd1b9a6f7f0daf0ec7ad72ae56e6f8b724b3c886447fdc532f2a79254b2651353d148ed0
7
- data.tar.gz: a835c33713bcc0dd9269c12e1dbe80f20a922ca8ceaf2e5ce3955b360f80c4a42a478d0e72de9d7df9bc2f0b34f29853eb6fb75c919a64ecfdad9eb41d678612
6
+ metadata.gz: be9485ce5f692f990c7b8c5b59c961311783fafb845c3580dbd0d08eb62e24c1067da75e98f24cd4553e7db21a15531ca2943c1633566995a6e7c64d6310d2f2
7
+ data.tar.gz: 3fbca263c9e5f399695e9cc69e50762fc72875860ad495c04368ff84d90c68100d5ca1b6db22aa17a5c2c52efccd4d99bc0c29b5485ae6608390a606fd35ac18
data/.gitignore CHANGED
@@ -2,3 +2,6 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ coverage/*
6
+ .DS_Store
7
+ .byebug_history
data/.travis.yml CHANGED
@@ -1,65 +1,47 @@
1
- services: mongodb
1
+ branches: master
2
2
 
3
3
  language: ruby
4
4
 
5
- sudo: false
6
-
7
5
  rvm:
8
- - 2.2.1
9
- - 2.1
10
- - 2.0
11
- - 1.9
6
+ - 2.6.6
12
7
 
13
- env:
14
- - RAILS=4-2-stable DB=mongodb
15
- - RAILS=4-2-stable DB=sqlite3
16
- - RAILS=4-2-stable DB=mysql
17
- - RAILS=4-2-stable DB=postgres
8
+ services:
9
+ - mysql
18
10
 
19
- - RAILS=4-1-stable DB=mongodb
20
- - RAILS=4-1-stable DB=sqlite3
21
- - RAILS=4-1-stable DB=mysql
22
- - RAILS=4-1-stable DB=postgres
11
+ env:
12
+ - RAILS=v6.1.0.rc1 DB=sqlite3
13
+ - RAILS=v6.1.0.rc1 DB=mysql
14
+ - RAILS=v6.1.0.rc1 DB=postgres
23
15
 
24
- - RAILS=4-0-stable DB=sqlite3
25
- - RAILS=4-0-stable DB=mysql
26
- - RAILS=4-0-stable DB=postgres
16
+ - RAILS=v6.0.3 DB=sqlite3
17
+ - RAILS=v6.0.3 DB=mysql
18
+ - RAILS=v6.0.3 DB=postgres
27
19
 
28
- - RAILS=3-2-stable DB=sqlite
29
- - RAILS=3-2-stable DB=mysql
30
- - RAILS=3-2-stable DB=postgres
20
+ - RAILS=6-0-stable DB=sqlite3
21
+ - RAILS=6-0-stable DB=mysql
22
+ - RAILS=6-0-stable DB=postgres
31
23
 
32
- - RAILS=3-1-stable DB=sqlite
33
- - RAILS=3-1-stable DB=mysql
34
- - RAILS=3-1-stable DB=postgres
24
+ - RAILS=5-2-stable DB=sqlite3
25
+ - RAILS=5-2-stable DB=mysql
26
+ - RAILS=5-2-stable DB=postgres
35
27
 
36
- matrix:
37
- include:
38
- - rvm: 2.2
39
- env: RAILS=master DB=sqlite3
40
- - rvm: 2.2
41
- env: RAILS=master DB=mysql
42
- - rvm: 2.2
43
- env: RAILS=master DB=postgres
44
- exclude:
45
- - rvm: 2.2
46
- env: RAILS=3-1-stable DB=sqlite
47
- - rvm: 2.2
48
- env: RAILS=3-1-stable DB=mysql
49
- - rvm: 2.2
50
- env: RAILS=3-1-stable DB=postgres
51
- allow_failures:
52
- - env: RAILS=master DB=sqlite3
53
- - env: RAILS=master DB=mysql
54
- - env: RAILS=master DB=postgres
55
- - rvm: 2.2
56
- env: RAILS=3-2-stable DB=sqlite
57
- - rvm: 2.2
58
- env: RAILS=3-2-stable DB=mysql
59
- - rvm: 2.2
60
- env: RAILS=3-2-stable DB=postgres
28
+ - RAILS=v5.2.4 DB=sqlite3
29
+ - RAILS=v5.2.4 DB=mysql
30
+ - RAILS=v5.2.4 DB=postgres
61
31
 
62
32
  before_script:
63
- - mysql -e 'create database ransack collate utf8_general_ci;'
64
- - mysql -e 'use ransack;show variables like "%character%";show variables like "%collation%";'
65
- - psql -c 'create database ransack;' -U postgres
33
+ - if [ "$DB" = "mysql" ];
34
+ then
35
+ mysql -e 'create database ransack collate utf8_general_ci;';
36
+ mysql -e 'use ransack;show variables like "%character%";show variables like "%collation%";';
37
+ fi
38
+
39
+ - if [ "$DB" = "postgres" ];
40
+ then
41
+ psql -c 'create database ransack;' -U postgres;
42
+ fi
43
+
44
+ addons:
45
+ code_climate:
46
+ repo_token: 8b701c4364d51a0217105e08c06922d600cec3d9e60d546a89e3ddfe46e0664e
47
+ postgresql: "9.6"
data/CHANGELOG.md CHANGED
@@ -1,9 +1,532 @@
1
1
  # Change Log
2
2
 
3
- ## Version 1.6.6 - 2015-04-05
3
+ ## 2.4.0 - 2020-11-27
4
+
5
+ *
6
+ PR []()
7
+
8
+ * Support ActiveRecord 6.1.0.rc1.
9
+ PR [1172](https://github.com/activerecord-hackery/ransack/pull/1172)
10
+
11
+ * 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)
12
+
13
+ * Drop support for ActiveRecord older than 5.2.4.
14
+ PR [1166](https://github.com/activerecord-hackery/ransack/pull/1166)
15
+
16
+ ## 2.3.2 - 2020-01-11
17
+
18
+ * Breakfix to bump Polyamorous
19
+
20
+ ## 2.3.1 - 2020-01-11
21
+
22
+ * Drop support for Active Record 5.0, 5.1, and 5.2.0.
23
+ PR [#1073](https://github.com/activerecord-hackery/ransack/pull/1073)
24
+
25
+ * Drop support for rubies under 2.3.
26
+ PR [#1070](https://github.com/activerecord-hackery/ransack/pull/1070)
27
+
28
+ ... and others
29
+
30
+ ## 2.3.0 - 2019-08-18
31
+
32
+ * Arabic translations PR [979](https://github.com/activerecord-hackery/ransack/pull/979)
33
+
34
+ * Rails 6 PR [1027](https://github.com/activerecord-hackery/ransack/pull/1027)
35
+ *vrodokanakis*
36
+
37
+ * Make polyamorous a separate gem PR [1002](https://github.com/activerecord-hackery/ransack/pull/1002)
38
+
39
+ * Catalan translations PR[1007](https://github.com/activerecord-hackery/ransack/pull/1007)
40
+ *roslavych*
41
+
42
+ * Don't escape period characters with wildcard searches in mysql2 PR [1013](https://github.com/activerecord-hackery/ransack/pull/1013)
43
+ *daflip*
44
+
45
+ * Farsi translations PR [1030](https://github.com/activerecord-hackery/ransack/pull/1030)
46
+
47
+ * Finnish translations PR [1049](https://github.com/activerecord-hackery/ransack/pull/1049)
48
+
49
+ * Fix wrong table alias when using nested join. for ActiveRecord >= 5.2
50
+ PR [374](https://github.com/activerecord-hackery/ransack/pull/374)
51
+
52
+ *hiichan*
53
+
54
+ ## Version 2.1.1 - 2018-12-05
55
+
56
+ * Add `arabic` translation
57
+ https://github.com/activerecord-hackery/ransack/pull/979
58
+
59
+ * Deprecate #search
60
+ PR [975](https://github.com/activerecord-hackery/ransack/pull/975)
61
+
62
+ ## Version 2.1.0 - 2018-10-26
63
+
64
+ * Add support for sorting by scopes
65
+ PR [973](https://github.com/activerecord-hackery/ransack/pull/973)
66
+
67
+ *Diego Borges*
68
+
69
+ * Added a new logo for Ransack
70
+ PR [972](https://github.com/activerecord-hackery/ransack/pull/972)
71
+
72
+ *Anıl Kılıç*, *Greg Molnar*
73
+
74
+ * Greek translations
75
+ PR [971](https://github.com/activerecord-hackery/ransack/pull/971)
76
+ PR [960](https://github.com/activerecord-hackery/ransack/pull/960)
77
+
78
+ *Sean Carroll*, *Greg Molnar*
79
+
80
+ * README improvements
81
+ PR [963](https://github.com/activerecord-hackery/ransack/pull/963)
82
+
83
+ *tommaso1*
84
+
85
+ * Bulgarian translations
86
+ PR [961](https://github.com/activerecord-hackery/ransack/pull/961)
87
+
88
+ *Sean Carroll*
89
+
90
+ * README improvements
91
+ PR [956](https://github.com/activerecord-hackery/ransack/pull/956)
92
+
93
+ *Alex Konoval*
94
+
95
+ * Remove lib/ransack/adapters/active_record/compat.rb
96
+ PR [954](https://github.com/activerecord-hackery/ransack/pull/954)
97
+
98
+ *Ryuta Kamizono*
99
+
100
+ * Remove unused aliases
101
+ PR [953](https://github.com/activerecord-hackery/ransack/pull/953)
102
+
103
+ *Ryuta Kamizono*
104
+
105
+ ## Version 2.0.1 - 2018-08-18
106
+
107
+ * Don't return association if table is nil
108
+ PR [952](https://github.com/activerecord-hackery/ransack/pull/952)
109
+
110
+ *Christian Gregg*
111
+
112
+ ## Version 2.0.0 - 2018-08-09
113
+
114
+ * Add support for Active Record 5.2.1
115
+ PR [#938](https://github.com/activerecord-hackery/ransack/pull/938)
116
+
117
+ * Fix sort with joins on existing association
118
+ PR [#937](https://github.com/activerecord-hackery/ransack/pull/937)
119
+
120
+ * Add the ability to skip arg sanitization on a per scope basis. Using
121
+ `ransackable_scopes_skip_sanitize_args`, users can define a list of
122
+ scopes which will bypass parameter sanitization. This allows passing 0,
123
+ 1, t, f, etc. to a scope as an actual parameter.
124
+ PR [#933](https://github.com/activerecord-hackery/ransack/pull/933)
125
+
126
+ * Drop support for Active Record < 5.0.
127
+ PR [#929](https://github.com/activerecord-hackery/ransack/pull/929)
128
+
129
+ * Extract mongoid support to a separate gem.
130
+ PR [#928](https://github.com/activerecord-hackery/ransack/pull/928)
131
+
132
+ * Absorb polyamorous
133
+ PR [#927](https://github.com/activerecord-hackery/ransack/pull/927)
134
+
135
+ * Fix broken monkey patch of #form_with
136
+ PR [#922](https://github.com/activerecord-hackery/ransack/pull/922)
137
+
138
+ ## Version 1.8.8 - 2018-03-16
139
+ * Fix multiple database support
140
+ PR [#893](https://github.com/activerecord-hackery/ransack/pull/893)
141
+
142
+ * Updated Dutch translations
143
+ PR [#887](https://github.com/activerecord-hackery/ransack/pull/887)
144
+
145
+ * Fixed no method error 'asc' for Rails 4.2
146
+ PR [#885](https://github.com/activerecord-hackery/ransack/pull/885)
147
+
148
+
149
+ ## Version 1.8.7 - 2018-02-05
150
+
151
+ * Rails 5.2 support
152
+ PR [#868](https://github.com/activerecord-hackery/ransack/pull/868)
153
+
154
+ * Lock pg gem to 0.21 to support older releases
155
+
156
+ * Warnings cleanup
157
+ PR [#867](https://github.com/activerecord-hackery/ransack/pull/867)
158
+
159
+ * Wildcard escaping
160
+ PR [#866]
161
+
162
+ ## Version 1.8.6 - 2018-01-23
163
+
164
+ ### Added
165
+
166
+ * Improve memory usage
167
+ PR [#820](https://github.com/activerecord-hackery/ransack/pull/820)
168
+
169
+ * Bump Polyamorous version to 1.3.2
170
+ PR [#858](https://github.com/activerecord-hackery/ransack/pull/858)
171
+
172
+ ## Version 1.8.5
173
+
174
+ ### Added
175
+
176
+ * Added Turkish Translations
177
+ PR [#835](https://github.com/activerecord-hackery/ransack/issues/835).
178
+
179
+ ## Version 1.8.4 - 2017-10-09
180
+
181
+ ### Added
182
+
183
+ * Added italian translations.
184
+ PR [#833](https://github.com/activerecord-hackery/ransack/pull/833).
185
+
186
+ * Add an optional default arrow for unsorted fields.
187
+ PR [#816](https://github.com/activerecord-hackery/ransack/pull/816/files).
188
+
189
+ ### Fixed
190
+
191
+ * Cast Postgres money type to float.
192
+ PR [#823](https://github.com/activerecord-hackery/ransack/pull/823).
193
+
194
+ * Fix the bug in sort_link, which causes the multiple fields option to be
195
+ ignored when block parameter is specified.
196
+ PR [#818](https://github.com/activerecord-hackery/ransack/pull/818).
197
+
198
+ * No need pass some arugments to JoinAssociation#join_constraints in Rails 5.1.
199
+ PR [#814](https://github.com/activerecord-hackery/ransack/pull/814).
200
+ Fixes [#807](https://github.com/activerecord-hackery/ransack/issues/807).
201
+ Reference [rails/rails#28267](https://github.com/rails/rails/pull/28267)
202
+ and [rails/rails#27851](https://github.com/rails/rails/pull/27851).
203
+
204
+ ## Version 1.8.3 - 2017-06-15
205
+
206
+ ### Added
207
+
208
+ * Add a config option to customize the up and down arrows used for direction
209
+ indicators in Ransack sort links.
210
+ PR [#726](https://github.com/activerecord-hackery/ransack/pull/726).
211
+
212
+ *Garett Arrowood*
213
+
214
+ * Add ability to turn off sanitization of custom scope arguments.
215
+ PR [#742](https://github.com/activerecord-hackery/ransack/pull/742).
216
+
217
+ *Garett Arrowood*
218
+
219
+ ### Fixed
220
+
221
+ * Use class attributes properly so that inheritance is respected.
222
+ PR [#717](https://github.com/activerecord-hackery/ransack/pull/717).
223
+ This fixes two bugs:
224
+
225
+ 1. In the Mongoid adapter, subclasses were not properly inheriting their
226
+ parents' Ransack aliases because each class defined its own set of
227
+ aliases.
228
+
229
+ 2. In the Active Record adapter, Ransack aliases were defined in such a way
230
+ that the parent's (and grandparent's, etc.) aliases were overwritten by
231
+ the child, meaning that all aliases were ultimately kept on
232
+ `ActiveRecord::Base`. This had the unfortunate effect of enforcing
233
+ uniqueness of Ransack alias names across all models rather than per
234
+ model. Depending on the load order of models, earlier definitions of an
235
+ alias in other models were clobbered.
236
+
237
+ *Steve Richert (laserlemon)*
238
+
239
+ * Use `ActiveSupport.on_load` hooks to include Ransack in Active Record,
240
+ avoiding autoloading the constant too soon. PR
241
+ [#719](https://github.com/activerecord-hackery/ransack/pull/719). Reference:
242
+ [This comment in rails#23589]
243
+ (https://github.com/rails/rails/issues/23589#issuecomment-229247727).
244
+
245
+ *Yuji Yaginuma (y-yagi)*
246
+
247
+ ## Version 1.8.2 - 2016-08-08
248
+ ### Fixed
249
+
250
+ * Fix empty attribute_fields regression in advanced search mode introduced by
251
+ [235eae3](https://github.com/activerecord-hackery/ransack/commit/235eae3).
252
+ Closes
253
+ [#701](https://github.com/activerecord-hackery/ransack/issues/701). Commit
254
+ [2839acf](https://github.com/activerecord-hackery/ransack/commit/2839acf).
255
+
256
+ *Jon Atack, Jay Dorsey, Stefan Haslinger, Igor Kasyanchuk*
257
+
258
+ ### Added
259
+
260
+ * Add `sort_url` view helper that returns only the url of a `sort_link`. PR
261
+ [#706](https://github.com/activerecord-hackery/ransack/pull/706).
262
+
263
+ *amatotsuji*
264
+
265
+ ## Version 1.8.1 - 2016-07-27
266
+ ### Fixed
267
+
268
+ * Fix `rake console` to run a command-line console with ransack + seed data.
269
+ Commits
270
+ [2cc781e](https://github.com/activerecord-hackery/ransack/commit/2cc781e),
271
+ [f2e85ad](https://github.com/activerecord-hackery/ransack/commit/f2e85ad),
272
+ [6a059ba](https://github.com/activerecord-hackery/ransack/commit/6a059ba).
273
+
274
+ *Jon Atack*
275
+
276
+ * Fix returned value of `Ransack::Nodes::Condition#format_predicate`. PR
277
+ [#692](https://github.com/activerecord-hackery/ransack/pull/692).
278
+
279
+ *Masahiro Saito*
280
+
281
+ * Better test coverage on passing arrays to ransackers. Commit
282
+ [98df2c5](https://github.com/activerecord-hackery/ransack/commit/98df2c5).
283
+
284
+ *Jon Atack*
285
+
286
+ * Fix missing Ransack::Constants::ASC constant. Commit
287
+ [aece23c](https://github.com/activerecord-hackery/ransack/commit/aece23c).
288
+
289
+ *Jon Atack*
290
+
291
+ ### Changed
292
+
293
+ * Replace arrow constants with frozen strings in public methods. Commits
294
+ [c0dff33](https://github.com/activerecord-hackery/ransack/commit/c0dff33),
295
+ [e489ca7](https://github.com/activerecord-hackery/ransack/commit/e489ca7).
296
+
297
+ *Jon Atack*
298
+
299
+ ## Version 1.8.0 - 2016-07-14
300
+ ### Added
301
+
302
+ * Support Mongoid 5. PR [#636](https://github.com/activerecord-hackery/ransack/pull/636), commit
303
+ [9e5faf4](https://github.com/activerecord-hackery/ransack/commit/9e5faf4).
304
+
305
+ *Josef Šimánek*
306
+
307
+ * Add optional block argument for the `sort_link` method. PR
308
+ [#604](https://github.com/activerecord-hackery/ransack/pull/604).
309
+
310
+ *Andrea Dal Ponte*
311
+
312
+ * Add `ransack_alias` to allow users to customize the names for long
313
+ ransack field names. PR
314
+ [#623](https://github.com/activerecord-hackery/ransack/pull/623).
315
+
316
+ *Ray Zane*
317
+
318
+ * Add support for searching on attributes that have been added to
319
+ Active Record models with `alias_attribute` (Rails >= 4 only). PR
320
+ [#592](https://github.com/activerecord-hackery/ransack/pull/592), commit
321
+ [549342a](https://github.com/activerecord-hackery/ransack/commit/549342a).
322
+
323
+ *Marten Schilstra*
324
+
325
+ * Add ability to globally hide sort link order indicator arrows with
326
+ `Ransack.configure#hide_sort_order_indicators = true`. PR
327
+ [#577](https://github.com/activerecord-hackery/ransack/pull/577), commit
328
+ [95d4591](https://github.com/activerecord-hackery/ransack/commit/95d4591).
329
+
330
+ *Josh Hunter*, *Jon Atack*
331
+
332
+ * Add test for `ActionController:Parameter` object params in `sort_link` to
333
+ ensure Ransack is handling the Rails 5 changes correctly. Commit
334
+ [b1cfed8](https://github.com/activerecord-hackery/ransack/commit/b1cfed8).
335
+
336
+ *Ryan Wood*
337
+
338
+ * Add failing tests to facilitate work on issue
339
+ [#566](https://github.com/activerecord-hackery/ransack/issues/566)
340
+ of passing boolean values to search scopes. PR
341
+ [#575](https://github.com/activerecord-hackery/ransack/pull/575).
342
+
343
+ *Marcel Eeken*
344
+
345
+ * Add i18n locale files:
346
+ * Taiwanese Hokkien/Mandarin (`zh-TW.yml`). PR
347
+ [#674](https://github.com/activerecord-hackery/ransack/pull/674). *Sibevin Wang*
348
+ * Danish (`da.yml`). PR
349
+ [#663](https://github.com/activerecord-hackery/ransack/pull/663). *Kasper Johansen*
350
+ * Brazilian Portuguese (`pt-BR.yml`). PR
351
+ [#581](https://github.com/activerecord-hackery/ransack/pull/581). *Diego Henrique Domingues*
352
+ * Indonesian (Bahasa) (`id.yml`). PR
353
+ [#612](https://github.com/activerecord-hackery/ransack/pull/612). *Adam Pahlevi Baihaqi*
354
+ * Japanese (`ja.yml`). PR
355
+ [#622](https://github.com/activerecord-hackery/ransack/pull/622). *Masanobu Mizutani*
356
+
357
+ ### Fixed
358
+
359
+ * In `FormHelper::SortLink#parameters_hash`, convert `params#to_unsafe_h`
360
+ only if Rails 5, and add tests. Commit
361
+ [14e66ca](https://github.com/activerecord-hackery/ransack/commit/14e66ca).
362
+
363
+ *Jon Atack*
364
+
365
+ * Respect negative conditions for collection associations and fix Mongoid
366
+ compat. PR [#645](https://github.com/activerecord-hackery/ransack/pull/645).
367
+
368
+ *Andrew Vit*
369
+
370
+ * Ensure conditions differing only by ransacker_args aren't filtered out.
371
+ PR [#665](https://github.com/activerecord-hackery/ransack/pull/665).
372
+
373
+ *Andrew Porterfield*
374
+
375
+ * Fix using aliased attributes in association searches, and add a failing
376
+ spec. PR [#602](https://github.com/activerecord-hackery/ransack/pull/602).
377
+
378
+ *Marten Schilstra*
379
+
380
+ * Replace Active Record `table_exists?` API that was deprecated
381
+ [here](https://github.com/rails/rails/commit/152b85f) in Rails 5. Commit
382
+ [c9d2297](https://github.com/activerecord-hackery/ransack/commit/c9d2297).
383
+
384
+ *Jon Atack*
385
+
386
+ * Adapt to changes in Rails 5 where AC::Parameters composes a HWIA instead of
387
+ inheriting from Hash starting from Rails commit rails/rails@14a3bd5. Commit
388
+ [ceafc05](https://github.com/activerecord-hackery/ransack/commit/ceafc05).
389
+
390
+ *Jon Atack*
391
+
392
+ * Fix test `#sort_link with hide order indicator set to true` to fail properly
393
+ ([4f65b09](https://github.com/activerecord-hackery/ransack/commit/4f65b09)).
394
+ This spec, added in
395
+ [#473](https://github.com/activerecord-hackery/ransack/pull/473), tested
396
+ the presence of the attribute name instead of the absence of the order
397
+ indicators and did not fail when it should.
398
+
399
+ *Josh Hunter*, *Jon Atack*
400
+
401
+ * Fix rspec-mocks `stub` deprecation warnings when running the tests. Commit
402
+ [600892e](https://github.com/activerecord-hackery/ransack/commit/600892e).
403
+
404
+ *Jon Atack*
405
+
406
+ * Revert
407
+ [f858dd6](https://github.com/activerecord-hackery/ransack/commit/f858dd6).
408
+ Fixes [#553](https://github.com/activerecord-hackery/ransack/issues/553)
409
+ performance regression with the SQL Server adapter.
410
+
411
+ *sschwing3*
412
+
413
+ * Fix invalid Chinese I18n locale file name by replacing "zh" with "zh-CN".
414
+ PR [#590](https://github.com/activerecord-hackery/ransack/pull/590).
415
+
416
+ *Ethan Yang*
417
+
4
418
  ### Changed
5
419
 
6
- * Upgrade Polyamorous dependency to version 1.2.0, which uses Module#prepend instead of monkey-patching for hooking into Active Record (with Ruby 2.x).
420
+ * Memory/speed perf improvement: Freeze strings in array global constants and
421
+ partially move from using global string constants to frozen strings
422
+ ([381a83c](https://github.com/activerecord-hackery/ransack/commit/381a83c)
423
+ and
424
+ [ce114ec](https://github.com/activerecord-hackery/ransack/commit/ce114ec)).
425
+
426
+ *Jon Atack*
427
+
428
+ * Escape underscore `_` wildcard characters with PostgreSQL and MySQL. PR
429
+ [#584](https://github.com/activerecord-hackery/ransack/issues/584).
430
+
431
+ *Igor Dobryn*
432
+
433
+ * Refactor `Ransack::Adapters` from conditionals to classes
434
+ ([94a404c](https://github.com/activerecord-hackery/ransack/commit/94a404c)).
435
+
436
+ *Jon Atack*
437
+
438
+ ## Version 1.7.0 - 2015-08-20
439
+ ### Added
440
+
441
+ * Add Mongoid support for referenced/embedded relations. PR
442
+ [#498](https://github.com/activerecord-hackery/ransack/pull/498).
443
+ TODO: Missing spec coverage! Add documentation!
444
+
445
+ *Penn Su*
446
+
447
+ * Add German i18n locale file (`de.yml`). PR
448
+ [#537](https://github.com/activerecord-hackery/ransack/pull/537).
449
+
450
+ *Philipp Weissensteiner*
451
+
452
+ ### Fixed
453
+
454
+ * Fix
455
+ [#499](https://github.com/activerecord-hackery/ransack/issues/499) and
456
+ [#549](https://github.com/activerecord-hackery/ransack/issues/549).
457
+ Ransack now loads only Active Record if both Active Record and Mongoid are
458
+ running to avoid the two adapters overriding each other. This clarifies
459
+ that Ransack currently knows how to work with only one database adapter
460
+ active at a time. PR
461
+ [#541](https://github.com/activerecord-hackery/ransack/pull/541).
462
+
463
+ *ASnow (Большов Андрей)*
464
+
465
+ * Fix [#299](https://github.com/activerecord-hackery/ransack/issues/299)
466
+ `attribute_method?` parsing for attribute names containing `_and_`
467
+ and `_or_`. Attributes named like `foo_and_bar` or `foo_or_bar` are
468
+ recognized now instead of running failing checks for `foo` and `bar`.
469
+ PR [#562](https://github.com/activerecord-hackery/ransack/pull/562).
470
+
471
+ *Ryohei Hoshi*
472
+
473
+ * Fix a time-dependent test failure. When the database has
474
+ `default_timezone = :local` (system time) and the `Time.zone` is set to
475
+ elsewhere, then `Date.current` does not match what the query produces for
476
+ the stored timestamps. Resolved by setting everything to UTC. PR
477
+ [#561](https://github.com/activerecord-hackery/ransack/pull/561).
478
+
479
+ *Andrew Vit*
480
+
481
+ * Avoid overwriting association conditions with default scope in Rails 3.
482
+ When a model with default scope was associated with conditions
483
+ (`has_many :x, conditions: ...`), the default scope would overwrite the
484
+ association conditions. This patch ensures that both sources of conditions
485
+ are applied. Avoid selecting records from joins that would normally be
486
+ filtered out if they were selected from the base table. Only applies to
487
+ Rails 3, as this issue was fixed since Rails 4. PR
488
+ [#560](https://github.com/activerecord-hackery/ransack/pull/560).
489
+
490
+ *Andrew Vit*
491
+
492
+ * Fix RSpec `its` method deprecation warning: "Use of rspec-core's its
493
+ method is deprecated. Use the rspec-its gem instead"
494
+ ([c09aa17](https://github.com/activerecord-hackery/ransack/commit/c09aa17)).
495
+
496
+ * Fix deprecated RSpec syntax in `grouping_spec.rb`
497
+ ([ba92a0b](https://github.com/activerecord-hackery/ransack/commit/ba92a0b)).
498
+
499
+ *Jon Atack*
500
+
501
+ ### Changed
502
+
503
+ * Upgrade gemspec dependencies: MySQL2 from '0.3.14' to '0.3.18', and RSpec
504
+ from '~> 2.14.0' to '~> 2' which loads 2.99
505
+ ([000cd22](https://github.com/activerecord-hackery/ransack/commit/000cd22)).
506
+
507
+ * Upgrade spec suite to RSpec 3 `expect` syntax backward compatible with
508
+ RSpec 2.9
509
+ ([87cd36d](https://github.com/activerecord-hackery/ransack/commit/87cd36d)
510
+ and
511
+ [d296caa](https://github.com/activerecord-hackery/ransack/commit/d296caa)).
512
+
513
+ * Various FormHelper refactorings
514
+ ([17dd97a](https://github.com/activerecord-hackery/ransack/commit/17dd97a)
515
+ and
516
+ [29a73b9](https://github.com/activerecord-hackery/ransack/commit/29a73b9)).
517
+
518
+ * Various documentation updates.
519
+
520
+ *Jon Atack*
521
+
522
+
523
+ ## Version 1.6.6 - 2015-04-05
524
+ ### Added
525
+
526
+ * Add the Ruby version to the the header message that shows the database,
527
+ Active Record and Arel versions when running tests.
528
+
529
+ * Add Code Climate analysis.
7
530
 
8
531
  *Jon Atack*
9
532
 
@@ -28,12 +551,10 @@
28
551
 
29
552
  *Jon Atack*
30
553
 
31
- ### Added
32
-
33
- * Add the Ruby version to the the header message that shows the database,
34
- Active Record and Arel versions when running tests.
554
+ ### Changed
35
555
 
36
- * Add Code Climate analysis.
556
+ * Upgrade Polyamorous dependency to version 1.2.0, which uses `Module#prepend`
557
+ instead of `alias_method` for hooking into Active Record (with Ruby 2.x).
37
558
 
38
559
  *Jon Atack*
39
560
 
@@ -150,7 +671,7 @@
150
671
 
151
672
  *Josh Kovach*
152
673
 
153
- * Add an sort_link option to not display sort direction arrows
674
+ * Add an sort_link option to not display sort order indicator arrows
154
675
  ([PR #473](https://github.com/activerecord-hackery/ransack/pull/473)).
155
676
 
156
677
  *Fred Bergman*
@@ -338,7 +859,7 @@
338
859
 
339
860
  *Pedro Chambino*
340
861
 
341
- * Add `ro.yml` Romanian translation file.
862
+ * Add Romanian i18n locale file (`ro.yml`).
342
863
 
343
864
  *Andreas Philippi*
344
865