ransack 2.3.2 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/SECURITY.md +12 -0
  4. data/.github/workflows/codeql.yml +72 -0
  5. data/.github/workflows/cronjob.yml +99 -0
  6. data/.github/workflows/deploy.yml +35 -0
  7. data/.github/workflows/rubocop.yml +20 -0
  8. data/.github/workflows/test-deploy.yml +29 -0
  9. data/.github/workflows/test.yml +131 -0
  10. data/.nojekyll +0 -0
  11. data/.rubocop.yml +50 -0
  12. data/CHANGELOG.md +251 -1
  13. data/CONTRIBUTING.md +51 -29
  14. data/Gemfile +12 -10
  15. data/README.md +45 -907
  16. data/bug_report_templates/test-ransack-scope-and-column-same-name.rb +78 -0
  17. data/bug_report_templates/test-ransacker-arel-present-predicate.rb +75 -0
  18. data/docs/.gitignore +19 -0
  19. data/docs/.nojekyll +0 -0
  20. data/docs/babel.config.js +3 -0
  21. data/docs/blog/2022-03-27-ransack-3.0.0.md +20 -0
  22. data/docs/docs/getting-started/_category_.json +4 -0
  23. data/docs/docs/getting-started/advanced-mode.md +46 -0
  24. data/docs/docs/getting-started/configuration.md +47 -0
  25. data/docs/docs/getting-started/search-matches.md +67 -0
  26. data/docs/docs/getting-started/simple-mode.md +288 -0
  27. data/docs/docs/getting-started/sorting.md +71 -0
  28. data/docs/docs/getting-started/using-predicates.md +282 -0
  29. data/docs/docs/going-further/_category_.json +4 -0
  30. data/docs/docs/going-further/acts-as-taggable-on.md +114 -0
  31. data/docs/docs/going-further/associations.md +70 -0
  32. data/docs/docs/going-further/custom-predicates.md +52 -0
  33. data/docs/docs/going-further/documentation.md +43 -0
  34. data/docs/docs/going-further/exporting-to-csv.md +49 -0
  35. data/docs/docs/going-further/external-guides.md +57 -0
  36. data/docs/docs/going-further/form-customisation.md +63 -0
  37. data/docs/docs/going-further/i18n.md +53 -0
  38. data/docs/docs/going-further/img/create_release.png +0 -0
  39. data/docs/docs/going-further/merging-searches.md +41 -0
  40. data/docs/docs/going-further/other-notes.md +428 -0
  41. data/docs/docs/going-further/polymorphic-search.md +46 -0
  42. data/docs/docs/going-further/ransackers.md +331 -0
  43. data/docs/docs/going-further/release_process.md +36 -0
  44. data/docs/docs/going-further/saving-queries.md +82 -0
  45. data/docs/docs/going-further/searching-postgres.md +57 -0
  46. data/docs/docs/going-further/wiki-contributors.md +82 -0
  47. data/docs/docs/intro.md +99 -0
  48. data/docs/docusaurus.config.js +120 -0
  49. data/docs/package.json +42 -0
  50. data/docs/sidebars.js +31 -0
  51. data/docs/src/components/HomepageFeatures/index.js +64 -0
  52. data/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  53. data/docs/src/css/custom.css +39 -0
  54. data/docs/src/pages/index.module.css +23 -0
  55. data/docs/src/pages/markdown-page.md +7 -0
  56. data/docs/static/.nojekyll +0 -0
  57. data/docs/static/img/docusaurus.png +0 -0
  58. data/docs/static/img/favicon.ico +0 -0
  59. data/docs/static/img/logo.svg +1 -0
  60. data/docs/static/img/tutorial/docsVersionDropdown.png +0 -0
  61. data/docs/static/img/tutorial/localeDropdown.png +0 -0
  62. data/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  63. data/docs/static/img/undraw_docusaurus_react.svg +170 -0
  64. data/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  65. data/docs/yarn.lock +8879 -0
  66. data/lib/polyamorous/activerecord/join_association.rb +70 -0
  67. data/{polyamorous/lib/polyamorous/activerecord_6.0_ruby_2 → lib/polyamorous/activerecord}/join_dependency.rb +33 -12
  68. data/lib/polyamorous/activerecord/reflection.rb +11 -0
  69. data/{polyamorous/lib → lib/polyamorous}/polyamorous.rb +3 -4
  70. data/lib/ransack/adapters/active_record/base.rb +83 -10
  71. data/lib/ransack/adapters/active_record/context.rb +56 -44
  72. data/lib/ransack/configuration.rb +53 -10
  73. data/lib/ransack/constants.rb +126 -4
  74. data/lib/ransack/context.rb +34 -5
  75. data/lib/ransack/helpers/form_builder.rb +6 -6
  76. data/lib/ransack/helpers/form_helper.rb +14 -5
  77. data/lib/ransack/helpers.rb +1 -1
  78. data/lib/ransack/locale/sv.yml +70 -0
  79. data/lib/ransack/nodes/attribute.rb +3 -3
  80. data/lib/ransack/nodes/condition.rb +80 -9
  81. data/lib/ransack/nodes/grouping.rb +4 -4
  82. data/lib/ransack/nodes/node.rb +1 -1
  83. data/lib/ransack/nodes/sort.rb +3 -3
  84. data/lib/ransack/nodes/value.rb +3 -3
  85. data/lib/ransack/predicate.rb +1 -1
  86. data/lib/ransack/ransacker.rb +1 -1
  87. data/lib/ransack/search.rb +15 -7
  88. data/lib/ransack/translate.rb +6 -6
  89. data/lib/ransack/version.rb +1 -1
  90. data/lib/ransack/visitor.rb +38 -2
  91. data/lib/ransack.rb +5 -8
  92. data/ransack.gemspec +9 -15
  93. data/spec/blueprints/articles.rb +1 -1
  94. data/spec/blueprints/comments.rb +1 -1
  95. data/spec/blueprints/notes.rb +1 -1
  96. data/spec/blueprints/tags.rb +1 -1
  97. data/spec/console.rb +5 -5
  98. data/spec/helpers/polyamorous_helper.rb +2 -8
  99. data/spec/helpers/ransack_helper.rb +1 -1
  100. data/spec/polyamorous/activerecord_compatibility_spec.rb +15 -0
  101. data/spec/{ransack → polyamorous}/join_association_spec.rb +3 -1
  102. data/spec/{ransack → polyamorous}/join_dependency_spec.rb +0 -16
  103. data/spec/ransack/adapters/active_record/base_spec.rb +125 -16
  104. data/spec/ransack/adapters/active_record/context_spec.rb +19 -18
  105. data/spec/ransack/configuration_spec.rb +33 -9
  106. data/spec/ransack/helpers/form_builder_spec.rb +8 -8
  107. data/spec/ransack/helpers/form_helper_spec.rb +109 -20
  108. data/spec/ransack/nodes/condition_spec.rb +37 -0
  109. data/spec/ransack/nodes/grouping_spec.rb +2 -2
  110. data/spec/ransack/nodes/value_spec.rb +115 -0
  111. data/spec/ransack/predicate_spec.rb +37 -2
  112. data/spec/ransack/search_spec.rb +238 -30
  113. data/spec/ransack/translate_spec.rb +1 -1
  114. data/spec/spec_helper.rb +7 -5
  115. data/spec/support/schema.rb +108 -11
  116. metadata +98 -62
  117. data/.travis.yml +0 -47
  118. data/lib/ransack/adapters/active_record/ransack/constants.rb +0 -128
  119. data/lib/ransack/adapters/active_record/ransack/context.rb +0 -55
  120. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +0 -61
  121. data/lib/ransack/adapters/active_record/ransack/translate.rb +0 -8
  122. data/lib/ransack/adapters/active_record/ransack/visitor.rb +0 -47
  123. data/lib/ransack/adapters.rb +0 -64
  124. data/lib/ransack/nodes.rb +0 -8
  125. data/polyamorous/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb +0 -20
  126. data/polyamorous/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb +0 -79
  127. data/polyamorous/lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb +0 -12
  128. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +0 -2
  129. data/polyamorous/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +0 -2
  130. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_association.rb +0 -2
  131. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/join_dependency.rb +0 -2
  132. data/polyamorous/lib/polyamorous/activerecord_6.1_ruby_2/reflection.rb +0 -2
  133. data/polyamorous/lib/polyamorous/version.rb +0 -3
  134. data/polyamorous/polyamorous.gemspec +0 -27
  135. /data/{logo → docs/static/logo}/ransack-h.png +0 -0
  136. /data/{logo → docs/static/logo}/ransack-h.svg +0 -0
  137. /data/{logo → docs/static/logo}/ransack-v.png +0 -0
  138. /data/{logo → docs/static/logo}/ransack-v.svg +0 -0
  139. /data/{logo → docs/static/logo}/ransack.png +0 -0
  140. /data/{logo → docs/static/logo}/ransack.svg +0 -0
  141. /data/{polyamorous/lib → lib}/polyamorous/join.rb +0 -0
  142. /data/{polyamorous/lib → lib}/polyamorous/swapping_reflection_class.rb +0 -0
  143. /data/{polyamorous/lib → lib}/polyamorous/tree_node.rb +0 -0
  144. /data/lib/ransack/{adapters/active_record.rb → active_record.rb} +0 -0
  145. /data/spec/{ransack → polyamorous}/join_spec.rb +0 -0
data/README.md CHANGED
@@ -1,961 +1,99 @@
1
- # ![Ransack](./logo/ransack-h.png "Ransack")
1
+ # ![Ransack](./docs/static/logo/ransack-h.png "Ransack")
2
2
 
3
- [![Build Status](https://travis-ci.org/activerecord-hackery/ransack.svg)](https://travis-ci.org/activerecord-hackery/ransack)
3
+ [![Build Status](https://github.com/activerecord-hackery/ransack/workflows/test/badge.svg)](https://github.com/activerecord-hackery/ransack/actions)
4
4
  [![Gem Version](https://badge.fury.io/rb/ransack.svg)](http://badge.fury.io/rb/ransack)
5
5
  [![Code Climate](https://codeclimate.com/github/activerecord-hackery/ransack/badges/gpa.svg)](https://codeclimate.com/github/activerecord-hackery/ransack)
6
6
  [![Backers on Open Collective](https://opencollective.com/ransack/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/ransack/sponsors/badge.svg)](#sponsors)
7
7
 
8
- Ransack enables the creation of both
9
- [simple](http://ransack-demo.herokuapp.com) and
10
- [advanced](http://ransack-demo.herokuapp.com/users/advanced_search) search forms
11
- for your Ruby on Rails application
12
- ([demo source code here](https://github.com/activerecord-hackery/ransack_demo)).
13
- If you're looking for something that simplifies query generation at the model
14
- or controller layer, you're probably not looking for Ransack (or MetaSearch,
15
- for that matter). Try [Squeel](https://github.com/activerecord-hackery/squeel)
16
- instead.
8
+ # Introduction
17
9
 
18
- ## Getting started
10
+ Ransack will help you easily add **searching to your Rails application**, without any additional dependencies.
19
11
 
20
- Ransack is compatible with Rails 6.0, 5.0, 5.1 and 5.2 on Ruby 2.3 and later.
12
+ There are advanced searching solutions around, like ElasticSearch or Algolia. **Ransack** will do the job for many Rails websites, without the need to run additional infrastructure or work in a different language. With Ransack you do it all with standard Ruby and ERB.
21
13
 
22
- In your Gemfile, for the last officially released gem:
14
+ Ready to move beyond the basics? Use **advanced features** like i18n and extensive configuration options.
23
15
 
24
- ```ruby
25
- gem 'ransack'
26
- ```
27
-
28
- If you would like to use the latest updates (recommended), use the `master`
29
- branch:
30
-
31
- ```ruby
32
- gem 'ransack', github: 'activerecord-hackery/ransack'
33
- ```
34
-
35
- ## Issues tracker
36
-
37
- * Before filing an issue, please read the [Contributing Guide](CONTRIBUTING.md).
38
- * File an issue if a bug is caused by Ransack, is new (has not already been reported), and _can be reproduced from the information you provide_.
39
- * Contributions are welcome, but please do not add "+1" comments to issues or pull requests :smiley:
40
- * Please do not use the issue tracker for personal support requests. Stack Overflow is a better place for that where a wider community can help you!
41
-
42
- ## Usage
43
-
44
- Ransack can be used in one of two modes, simple or advanced.
45
-
46
- ### Simple Mode
47
-
48
- This mode works much like MetaSearch, for those of you who are familiar with
49
- it, and requires very little setup effort.
50
-
51
- If you're coming from MetaSearch, things to note:
52
-
53
- 1. The default param key for search params is now `:q`, instead of `:search`.
54
- This is primarily to shorten query strings, though advanced queries (below)
55
- will still run afoul of URL length limits in most browsers and require a
56
- switch to HTTP POST requests. This key is [configurable](https://github.com/activerecord-hackery/ransack/wiki/Configuration).
57
-
58
- 2. `form_for` is now `search_form_for`, and validates that a Ransack::Search
59
- object is passed to it.
60
-
61
- 3. Common ActiveRecord::Relation methods are no longer delegated by the
62
- search object. Instead, you will get your search results (an
63
- ActiveRecord::Relation in the case of the ActiveRecord adapter) via a call to
64
- `Ransack#result`.
65
-
66
- #### In your controller
67
-
68
- ```ruby
69
- def index
70
- @q = Person.ransack(params[:q])
71
- @people = @q.result(distinct: true)
72
- end
73
- ```
74
- or without `distinct: true`, for sorting on an associated table's columns (in
75
- this example, with preloading each Person's Articles and pagination):
76
-
77
- ```ruby
78
- def index
79
- @q = Person.ransack(params[:q])
80
- @people = @q.result.includes(:articles).page(params[:page])
81
-
82
- # or use `to_a.uniq` to remove duplicates (can also be done in the view):
83
- @people = @q.result.includes(:articles).page(params[:page]).to_a.uniq
84
- end
85
- ```
86
-
87
- #### In your view
16
+ Ransack is supported for Rails 7.0, 6.1 on Ruby 3.0 and later.
88
17
 
89
- The two primary Ransack view helpers are `search_form_for` and `sort_link`,
90
- which are defined in
91
- [Ransack::Helpers::FormHelper](lib/ransack/helpers/form_helper.rb).
92
-
93
- #### Ransack's `search_form_for` helper replaces `form_for` for creating the view search form
94
-
95
- ```erb
96
- <%= search_form_for @q do |f| %>
97
-
98
- # Search if the name field contains...
99
- <%= f.label :name_cont %>
100
- <%= f.search_field :name_cont %>
101
-
102
- # Search if an associated articles.title starts with...
103
- <%= f.label :articles_title_start %>
104
- <%= f.search_field :articles_title_start %>
105
-
106
- # Attributes may be chained. Search multiple attributes for one value...
107
- <%= f.label :name_or_description_or_email_or_articles_title_cont %>
108
- <%= f.search_field :name_or_description_or_email_or_articles_title_cont %>
109
-
110
- <%= f.submit %>
111
- <% end %>
112
- ```
113
-
114
- The argument of `f.search_field` has to be in this form:
115
- `attribute_name[_or_attribute_name]..._predicate`
116
-
117
- where `[_or_another_attribute_name]...` means any repetition of `_or_` plus the name of the attribute.
118
-
119
- `cont` (contains) and `start` (starts with) are just two of the available
120
- search predicates. See
121
- [Constants](https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/constants.rb)
122
- for a full list and the
123
- [wiki](https://github.com/activerecord-hackery/ransack/wiki/Basic-Searching)
124
- for more information.
125
-
126
- The `search_form_for` answer format can be set like this:
127
-
128
- ```erb
129
- <%= search_form_for(@q, format: :pdf) do |f| %>
130
-
131
- <%= search_form_for(@q, format: :json) do |f| %>
132
- ```
133
-
134
- #### Ransack's `sort_link` helper creates table headers that are sortable links
135
-
136
- ```erb
137
- <%= sort_link(@q, :name) %>
138
- ```
139
- Additional options can be passed after the column attribute, like a different
140
- column title or a default sort order:
141
-
142
- ```erb
143
- <%= sort_link(@q, :name, 'Last Name', default_order: :desc) %>
144
- ```
145
-
146
- You can use a block if the link markup is hard to fit into the label parameter:
147
-
148
- ```erb
149
- <%= sort_link(@q, :name) do %>
150
- <strong>Player Name</strong>
151
- <% end %>
152
- ```
153
-
154
- With a polymorphic association, you may need to specify the name of the link
155
- explicitly to avoid an `uninitialized constant Model::Xxxable` error (see issue
156
- [#421](https://github.com/activerecord-hackery/ransack/issues/421)):
157
-
158
- ```erb
159
- <%= sort_link(@q, :xxxable_of_Ymodel_type_some_attribute, 'Attribute Name') %>
160
- ```
18
+ ## Installation
161
19
 
162
- You can also sort on multiple fields by specifying an ordered array:
163
-
164
- ```erb
165
- <%= sort_link(@q, :last_name, [:last_name, 'first_name asc'], 'Last Name') %>
166
- ```
167
-
168
- In the example above, clicking the link will sort by `last_name` and then
169
- `first_name`. Specifying the sort direction on a field in the array tells
170
- Ransack to _always_ sort that particular field in the specified direction.
171
-
172
- Multiple `default_order` fields may also be specified with a hash:
173
-
174
- ```erb
175
- <%= sort_link(@q, :last_name, %i(last_name first_name),
176
- default_order: { last_name: 'asc', first_name: 'desc' }) %>
177
- ```
178
-
179
- This example toggles the sort directions of both fields, by default
180
- initially sorting the `last_name` field by ascending order, and the
181
- `first_name` field by descending order.
182
-
183
- In the case that you wish to sort by some complex value, such as the result
184
- of a SQL function, you may do so using scopes. In your model, define scopes
185
- whose names line up with the name of the virtual field you wish to sort by,
186
- as so:
187
-
188
- ```ruby
189
- class Person < ActiveRecord::Base
190
- scope :sort_by_reverse_name_asc, lambda { order("REVERSE(name) ASC") }
191
- scope :sort_by_reverse_name_desc, lambda { order("REVERSE(name) DESC") }
192
- ...
193
- ```
194
-
195
- and you can then sort by this virtual field:
196
-
197
- ```erb
198
- <%= sort_link(@q, :reverse_name) %>
199
- ```
200
-
201
- The sort link order indicator arrows may be globally customized by setting a
202
- `custom_arrows` option in an initializer file like
203
- `config/initializers/ransack.rb`.
204
-
205
- You can also enable a `default_arrow` which is displayed on all sortable fields
206
- which are not currently used in the sorting. This is disabled by default so
207
- nothing will be displayed:
208
-
209
- ```ruby
210
- Ransack.configure do |c|
211
- c.custom_arrows = {
212
- up_arrow: '<i class="custom-up-arrow-icon"></i>',
213
- down_arrow: 'U+02193',
214
- default_arrow: '<i class="default-arrow-icon"></i>'
215
- }
216
- end
217
- ```
218
-
219
- All sort links may be displayed without the order indicator
220
- arrows by setting `hide_sort_order_indicators` to true in the initializer file.
221
- Note that this hides the arrows even if they were customized:
222
-
223
- ```ruby
224
- Ransack.configure do |c|
225
- c.hide_sort_order_indicators = true
226
- end
227
- ```
228
-
229
- Without setting it globally, individual sort links may be displayed without
230
- the order indicator arrow by passing `hide_indicator: true` in the sort link:
231
-
232
- ```erb
233
- <%= sort_link(@q, :name, hide_indicator: true) %>
234
- ```
235
-
236
- #### Ransack's `sort_url` helper is like a `sort_link` but returns only the url
237
-
238
- `sort_url` has the same API as `sort_link`:
239
-
240
- ```erb
241
- <%= sort_url(@q, :name, default_order: :desc) %>
242
- ```
243
-
244
- ```erb
245
- <%= sort_url(@q, :last_name, [:last_name, 'first_name asc']) %>
246
- ```
247
-
248
- ```erb
249
- <%= sort_url(@q, :last_name, %i(last_name first_name),
250
- default_order: { last_name: 'asc', first_name: 'desc' }) %>
251
- ```
252
-
253
- ### Advanced Mode
254
-
255
- "Advanced" searches (ab)use Rails' nested attributes functionality in order to
256
- generate complex queries with nested AND/OR groupings, etc. This takes a bit
257
- more work but can generate some pretty cool search interfaces that put a lot of
258
- power in the hands of your users. A notable drawback with these searches is
259
- that the increased size of the parameter string will typically force you to use
260
- the HTTP POST method instead of GET. :(
261
-
262
- This means you'll need to tweak your routes...
263
-
264
- ```ruby
265
- resources :people do
266
- collection do
267
- match 'search' => 'people#search', via: [:get, :post], as: :search
268
- end
269
- end
270
- ```
271
-
272
- ... and add another controller action ...
273
-
274
- ```ruby
275
- def search
276
- index
277
- render :index
278
- end
279
- ```
280
-
281
- ... and update your `search_form_for` line in the view ...
282
-
283
- ```erb
284
- <%= search_form_for @q, url: search_people_path,
285
- html: { method: :post } do |f| %>
286
- ```
287
-
288
- Once you've done so, you can make use of the helpers in [Ransack::Helpers::FormBuilder](lib/ransack/helpers/form_builder.rb) to
289
- construct much more complex search forms, such as the one on the
290
- [demo app](http://ransack-demo.herokuapp.com/users/advanced_search)
291
- (source code [here](https://github.com/activerecord-hackery/ransack_demo)).
292
-
293
- ### Ransack #search method
294
-
295
- Ransack will try to make the class method `#search` available in your
296
- models, but if `#search` has already been defined elsewhere, you can always use
297
- the default `#ransack` class method. So the following are equivalent:
298
-
299
- ```ruby
300
- Article.ransack(params[:q])
301
- Article.search(params[:q])
302
- ```
303
-
304
- Users have reported issues of `#search` name conflicts with other gems, so
305
- the `#search` method alias will be deprecated in the next major version of
306
- Ransack (2.0). It's advisable to use the default `#ransack` instead.
307
-
308
- For now, if Ransack's `#search` method conflicts with the name of another
309
- method named `search` in your code or another gem, you may resolve it either by
310
- patching the `extended` class_method in `Ransack::Adapters::ActiveRecord::Base`
311
- to remove the line `alias :search :ransack unless base.respond_to? :search`, or
312
- by placing the following line in your Ransack initializer file at
313
- `config/initializers/ransack.rb`:
314
-
315
- ```ruby
316
- Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
317
- ```
20
+ To install `ransack` and add it to your Gemfile, run
318
21
 
319
- ### Associations
320
-
321
- You can easily use Ransack to search for objects in `has_many` and `belongs_to`
322
- associations.
323
-
324
- Given these associations...
325
-
326
- ```ruby
327
- class Employee < ActiveRecord::Base
328
- belongs_to :supervisor
329
-
330
- # has attributes first_name:string and last_name:string
331
- end
332
-
333
- class Department < ActiveRecord::Base
334
- has_many :supervisors
335
-
336
- # has attribute title:string
337
- end
338
-
339
- class Supervisor < ActiveRecord::Base
340
- belongs_to :department
341
- has_many :employees
342
-
343
- # has attribute last_name:string
344
- end
345
- ```
346
-
347
- ... and a controller...
348
-
349
- ```ruby
350
- class SupervisorsController < ApplicationController
351
- def index
352
- @q = Supervisor.ransack(params[:q])
353
- @supervisors = @q.result.includes(:department, :employees)
354
- end
355
- end
356
- ```
357
-
358
- ... you might set up your form like this...
359
-
360
- ```erb
361
- <%= search_form_for @q do |f| %>
362
- <%= f.label :last_name_cont %>
363
- <%= f.search_field :last_name_cont %>
364
-
365
- <%= f.label :department_title_cont %>
366
- <%= f.search_field :department_title_cont %>
367
-
368
- <%= f.label :employees_first_name_or_employees_last_name_cont %>
369
- <%= f.search_field :employees_first_name_or_employees_last_name_cont %>
370
-
371
- <%= f.submit "search" %>
372
- <% end %>
373
- ...
374
- <%= content_tag :table do %>
375
- <%= content_tag :th, sort_link(@q, :last_name) %>
376
- <%= content_tag :th, sort_link(@q, :department_title) %>
377
- <%= content_tag :th, sort_link(@q, :employees_last_name) %>
378
- <% end %>
379
- ```
380
-
381
- If you have trouble sorting on associations, try using an SQL string with the
382
- pluralized table (`'departments.title'`,`'employees.last_name'`) instead of the
383
- symbolized association (`:department_title)`, `:employees_last_name`).
384
-
385
- ### Ransack Aliases
386
-
387
- You can customize the attribute names for your Ransack searches by using a
388
- `ransack_alias`. This is particularly useful for long attribute names that are
389
- necessary when querying associations or multiple columns.
390
-
391
- ```ruby
392
- class Post < ActiveRecord::Base
393
- belongs_to :author
394
-
395
- # Abbreviate :author_first_name_or_author_last_name to :author
396
- ransack_alias :author, :author_first_name_or_author_last_name
397
- end
398
- ```
399
-
400
- Now, rather than using `:author_first_name_or_author_last_name_cont` in your
401
- form, you can simply use `:author_cont`. This serves to produce more expressive
402
- query parameters in your URLs.
403
-
404
- ```erb
405
- <%= search_form_for @q do |f| %>
406
- <%= f.label :author_cont %>
407
- <%= f.search_field :author_cont %>
408
- <% end %>
409
- ```
410
-
411
- ### Search Matchers
412
-
413
- List of all possible predicates
414
-
415
-
416
- | Predicate | Description | Notes |
417
- | ------------- | ------------- |-------- |
418
- | `*_eq` | equal | |
419
- | `*_not_eq` | not equal | |
420
- | `*_matches` | matches with `LIKE` | e.g. `q[email_matches]=%@gmail.com`|
421
- | `*_does_not_match` | does not match with `LIKE` | |
422
- | `*_matches_any` | Matches any | |
423
- | `*_matches_all` | Matches all | |
424
- | `*_does_not_match_any` | Does not match any | |
425
- | `*_does_not_match_all` | Does not match all | |
426
- | `*_lt` | less than | |
427
- | `*_lteq` | less than or equal | |
428
- | `*_gt` | greater than | |
429
- | `*_gteq` | greater than or equal | |
430
- | `*_present` | not null and not empty | Only compatible with string columns. Example: `q[name_present]=1` (SQL: `col is not null AND col != ''`) |
431
- | `*_blank` | is null or empty. | (SQL: `col is null OR col = ''`) |
432
- | `*_null` | is null | |
433
- | `*_not_null` | is not null | |
434
- | `*_in` | match any values in array | e.g. `q[name_in][]=Alice&q[name_in][]=Bob` |
435
- | `*_not_in` | match none of values in array | |
436
- | `*_lt_any` | Less than any | SQL: `col < value1 OR col < value2` |
437
- | `*_lteq_any` | Less than or equal to any | |
438
- | `*_gt_any` | Greater than any | |
439
- | `*_gteq_any` | Greater than or equal to any | |
440
- | `*_matches_any` | `*_does_not_match_any` | same as above but with `LIKE` |
441
- | `*_lt_all` | Less than all | SQL: `col < value1 AND col < value2` |
442
- | `*_lteq_all` | Less than or equal to all | |
443
- | `*_gt_all` | Greater than all | |
444
- | `*_gteq_all` | Greater than or equal to all | |
445
- | `*_matches_all` | Matches all | same as above but with `LIKE` |
446
- | `*_does_not_match_all` | Does not match all | |
447
- | `*_not_eq_all` | none of values in a set | |
448
- | `*_start` | Starts with | SQL: `col LIKE 'value%'` |
449
- | `*_not_start` | Does not start with | |
450
- | `*_start_any` | Starts with any of | |
451
- | `*_start_all` | Starts with all of | |
452
- | `*_not_start_any` | Does not start with any of | |
453
- | `*_not_start_all` | Does not start with all of | |
454
- | `*_end` | Ends with | SQL: `col LIKE '%value'` |
455
- | `*_not_end` | Does not end with | |
456
- | `*_end_any` | Ends with any of | |
457
- | `*_end_all` | Ends with all of | |
458
- | `*_not_end_any` | | |
459
- | `*_not_end_all` | | |
460
- | `*_cont` | Contains value | uses `LIKE` |
461
- | `*_cont_any` | Contains any of | |
462
- | `*_cont_all` | Contains all of | |
463
- | `*_not_cont` | Does not contain |
464
- | `*_not_cont_any` | Does not contain any of | |
465
- | `*_not_cont_all` | Does not contain all of | |
466
- | `*_i_cont` | Contains value with case insensitive | uses `LIKE` |
467
- | `*_i_cont_any` | Contains any of values with case insensitive | |
468
- | `*_i_cont_all` | Contains all of values with case insensitive | |
469
- | `*_not_i_cont` | Does not contain with case insensitive |
470
- | `*_not_i_cont_any` | Does not contain any of values with case insensitive | |
471
- | `*_not_i_cont_all` | Does not contain all of values with case insensitive | |
472
- | `*_true` | is true | |
473
- | `*_false` | is false | |
474
-
475
-
476
- (See full list: https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/locale/en.yml#L15 and [wiki](https://github.com/activerecord-hackery/ransack/wiki/Basic-Searching))
477
-
478
- ### Using Ransackers to add custom search functions via Arel
479
-
480
- The main premise behind Ransack is to provide access to
481
- **Arel predicate methods**. Ransack provides special methods, called
482
- _ransackers_, for creating additional search functions via Arel. More
483
- information about `ransacker` methods can be found [here in the wiki](https://github.com/activerecord-hackery/ransack/wiki/Using-Ransackers).
484
- Feel free to contribute working `ransacker` code examples to the wiki!
485
-
486
- ### Problem with DISTINCT selects
487
-
488
- If passed `distinct: true`, `result` will generate a `SELECT DISTINCT` to
489
- avoid returning duplicate rows, even if conditions on a join would otherwise
490
- result in some. It generates the same SQL as calling `uniq` on the relation.
491
-
492
- Please note that for many databases, a sort on an associated table's columns
493
- may result in invalid SQL with `distinct: true` -- in those cases, you
494
- will need to modify the result as needed to allow these queries to work.
495
-
496
- For example, you could call joins and includes on the result which has the
497
- effect of adding those tables columns to the select statement, overcoming
498
- the issue, like so:
499
-
500
- ```ruby
501
- def index
502
- @q = Person.ransack(params[:q])
503
- @people = @q.result(distinct: true)
504
- .includes(:articles)
505
- .joins(:articles)
506
- .page(params[:page])
507
- end
508
- ```
509
-
510
- If the above doesn't help, you can also use ActiveRecord's `select` query
511
- to explicitly add the columns you need, which brute force's adding the
512
- columns you need that your SQL engine is complaining about, you need to
513
- make sure you give all of the columns you care about, for example:
514
-
515
- ```ruby
516
- def index
517
- @q = Person.ransack(params[:q])
518
- @people = @q.result(distinct: true)
519
- .select('people.*, articles.name, articles.description')
520
- .page(params[:page])
521
- end
522
- ```
523
-
524
- Another method to approach this when using Postgresql is to use ActiveRecords's `.includes` in combination with `.group` instead of `distinct: true`.
525
-
526
- For example:
527
- ```ruby
528
- def index
529
- @q = Person.ransack(params[:q])
530
- @people = @q.result
531
- .group('persons.id')
532
- .includes(:articles)
533
- .page(params[:page])
534
- end
535
-
536
- ```
537
-
538
- A final way of last resort is to call `to_a.uniq` on the collection at the end
539
- with the caveat that the de-duping is taking place in Ruby instead of in SQL,
540
- which is potentially slower and uses more memory, and that it may display
541
- awkwardly with pagination if the number of results is greater than the page size.
542
-
543
- For example:
544
-
545
- ```ruby
546
- def index
547
- @q = Person.ransack(params[:q])
548
- @people = @q.result.includes(:articles).page(params[:page]).to_a.uniq
549
- end
550
- ```
551
-
552
- #### `PG::UndefinedFunction: ERROR: could not identify an equality operator for type json`
553
-
554
- If you get the above error while using `distinct: true` that means that
555
- one of the columns that Ransack is selecting is a `json` column.
556
- PostgreSQL does not provide comparison operators for the `json` type. While
557
- it is possible to work around this, in practice it's much better to convert those
558
- to `jsonb`, as [recommended by the PostgreSQL documentation](https://www.postgresql.org/docs/9.6/static/datatype-json.html).
559
-
560
- ### Authorization (whitelisting/blacklisting)
561
-
562
- By default, searching and sorting are authorized on any column of your model
563
- and no class methods/scopes are whitelisted.
564
-
565
- Ransack adds four methods to `ActiveRecord::Base` that you can redefine as
566
- class methods in your models to apply selective authorization:
567
- `ransackable_attributes`, `ransackable_associations`, `ransackable_scopes` and
568
- `ransortable_attributes`.
569
-
570
- Here is how these four methods are implemented in Ransack:
571
-
572
- ```ruby
573
- # `ransackable_attributes` by default returns all column names
574
- # and any defined ransackers as an array of strings.
575
- # For overriding with a whitelist array of strings.
576
- #
577
- def ransackable_attributes(auth_object = nil)
578
- column_names + _ransackers.keys
579
- end
580
-
581
- # `ransackable_associations` by default returns the names
582
- # of all associations as an array of strings.
583
- # For overriding with a whitelist array of strings.
584
- #
585
- def ransackable_associations(auth_object = nil)
586
- reflect_on_all_associations.map { |a| a.name.to_s }
587
- end
588
-
589
- # `ransortable_attributes` by default returns the names
590
- # of all attributes available for sorting as an array of strings.
591
- # For overriding with a whitelist array of strings.
592
- #
593
- def ransortable_attributes(auth_object = nil)
594
- ransackable_attributes(auth_object)
595
- end
596
-
597
- # `ransackable_scopes` by default returns an empty array
598
- # i.e. no class methods/scopes are authorized.
599
- # For overriding with a whitelist array of *symbols*.
600
- #
601
- def ransackable_scopes(auth_object = nil)
602
- []
603
- end
604
- ```
605
-
606
- Any values not returned from these methods will be ignored by Ransack, i.e.
607
- they are not authorized.
608
-
609
- All four methods can receive a single optional parameter, `auth_object`. When
610
- you call the search or ransack method on your model, you can provide a value
611
- for an `auth_object` key in the options hash which can be used by your own
612
- overridden methods.
613
-
614
- Here is an example that puts all this together, adapted from
615
- [this blog post by Ernie Miller](http://erniemiller.org/2012/05/11/why-your-ruby-class-macros-might-suck-mine-did/).
616
- In an `Article` model, add the following `ransackable_attributes` class method
617
- (preferably private):
618
-
619
- ```ruby
620
- class Article < ActiveRecord::Base
621
- def self.ransackable_attributes(auth_object = nil)
622
- if auth_object == :admin
623
- # whitelist all attributes for admin
624
- super
625
- else
626
- # whitelist only the title and body attributes for other users
627
- super & %w(title body)
628
- end
629
- end
630
-
631
- private_class_method :ransackable_attributes
632
- end
633
- ```
634
-
635
- Here is example code for the `articles_controller`:
636
-
637
- ```ruby
638
- class ArticlesController < ApplicationController
639
- def index
640
- @q = Article.ransack(params[:q], auth_object: set_ransack_auth_object)
641
- @articles = @q.result
642
- end
643
-
644
- private
645
-
646
- def set_ransack_auth_object
647
- current_user.admin? ? :admin : nil
648
- end
649
- end
650
- ```
651
-
652
- Trying it out in `rails console`:
653
-
654
- ```ruby
655
- > Article
656
- => Article(id: integer, person_id: integer, title: string, body: text)
657
-
658
- > Article.ransackable_attributes
659
- => ["title", "body"]
660
-
661
- > Article.ransackable_attributes(:admin)
662
- => ["id", "person_id", "title", "body"]
663
-
664
- > Article.ransack(id_eq: 1).result.to_sql
665
- => SELECT "articles".* FROM "articles" # Note that search param was ignored!
666
-
667
- > Article.ransack({ id_eq: 1 }, { auth_object: nil }).result.to_sql
668
- => SELECT "articles".* FROM "articles" # Search param still ignored!
669
-
670
- > Article.ransack({ id_eq: 1 }, { auth_object: :admin }).result.to_sql
671
- => SELECT "articles".* FROM "articles" WHERE "articles"."id" = 1
672
- ```
673
-
674
- That's it! Now you know how to whitelist/blacklist various elements in Ransack.
675
-
676
- ### Using Scopes/Class Methods
677
-
678
- Continuing on from the preceding section, searching by scopes requires defining
679
- a whitelist of `ransackable_scopes` on the model class. The whitelist should be
680
- an array of *symbols*. By default, all class methods (e.g. scopes) are ignored.
681
- Scopes will be applied for matching `true` values, or for given values if the
682
- scope accepts a value:
683
-
684
- ```ruby
685
- class Employee < ActiveRecord::Base
686
- scope :activated, ->(boolean = true) { where(active: boolean) }
687
- scope :salary_gt, ->(amount) { where('salary > ?', amount) }
688
-
689
- # Scopes are just syntactical sugar for class methods, which may also be used:
690
-
691
- def self.hired_since(date)
692
- where('start_date >= ?', date)
693
- end
694
-
695
- def self.ransackable_scopes(auth_object = nil)
696
- if auth_object.try(:admin?)
697
- # allow admin users access to all three methods
698
- %i(activated hired_since salary_gt)
699
- else
700
- # allow other users to search on `activated` and `hired_since` only
701
- %i(activated hired_since)
702
- end
703
- end
704
- end
705
-
706
- Employee.ransack({ activated: true, hired_since: '2013-01-01' })
707
-
708
- Employee.ransack({ salary_gt: 100_000 }, { auth_object: current_user })
709
- ```
710
-
711
- In Rails 3 and 4, if the `true` value is being passed via url params or some
712
- other mechanism that will convert it to a string, the true value may not be
713
- passed to the ransackable scope unless you wrap it in an array
714
- (i.e. `activated: ['true']`). Ransack will take care of changing 'true' into a
715
- boolean. This is currently resolved in Rails 5 :smiley:
716
-
717
- However, perhaps you have `user_id: [1]` and you do not want Ransack to convert
718
- 1 into a boolean. (Values sanitized to booleans can be found in the
719
- [constants.rb](https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/constants.rb#L28)).
720
- To turn this off globally, and handle type conversions yourself, set
721
- `sanitize_custom_scope_booleans` to false in an initializer file like
722
- config/initializers/ransack.rb:
723
-
724
- ```ruby
725
- Ransack.configure do |c|
726
- c.sanitize_custom_scope_booleans = false
727
- end
728
- ```
729
-
730
- To turn this off on a per-scope basis Ransack adds the following method to
731
- `ActiveRecord::Base` that you can redefine to selectively override sanitization:
732
-
733
- `ransackable_scopes_skip_sanitize_args`
734
-
735
- Add the scope you wish to bypass this behavior to ransackable_scopes_skip_sanitize_args:
736
-
737
- ```ruby
738
- def self.ransackable_scopes_skip_sanitize_args
739
- [:scope_to_skip_sanitize_args]
740
- end
741
- ```
742
-
743
- Scopes are a recent addition to Ransack and currently have a few caveats:
744
- First, a scope involving child associations needs to be defined in the parent
745
- table model, not in the child model. Second, scopes with an array as an
746
- argument are not easily usable yet, because the array currently needs to be
747
- wrapped in an array to function (see
748
- [this issue](https://github.com/activerecord-hackery/ransack/issues/404)),
749
- which is not compatible with Ransack form helpers. For this use case, it may be
750
- better for now to use [ransackers](https://github.com/activerecord-hackery/ransack/wiki/Using-Ransackers) instead,
751
- where feasible. Pull requests with solutions and tests are welcome!
752
-
753
- ### Grouping queries by OR instead of AND
754
-
755
- The default `AND` grouping can be changed to `OR` by adding `m: 'or'` to the
756
- query hash.
757
-
758
- You can easily try it in your controller code by changing `params[:q]` in the
759
- `index` action to `params[:q].try(:merge, m: 'or')` as follows:
760
-
761
- ```ruby
762
- def index
763
- @q = Artist.ransack(params[:q].try(:merge, m: 'or'))
764
- @artists = @q.result
765
- end
766
- ```
767
- Normally, if you wanted users to be able to toggle between `AND` and `OR`
768
- query grouping, you would probably set up your search form so that `m` was in
769
- the URL params hash, but here we assigned `m` manually just to try it out
770
- quickly.
771
-
772
- Alternatively, trying it in the Rails console:
773
-
774
- ```ruby
775
- artists = Artist.ransack(name_cont: 'foo', style_cont: 'bar', m: 'or')
776
- => Ransack::Search<class: Artist, base: Grouping <conditions: [
777
- Condition <attributes: ["name"], predicate: cont, values: ["foo"]>,
778
- Condition <attributes: ["style"], predicate: cont, values: ["bar"]>
779
- ], combinator: or>>
780
-
781
- artists.result.to_sql
782
- => "SELECT \"artists\".* FROM \"artists\"
783
- WHERE ((\"artists\".\"name\" ILIKE '%foo%'
784
- OR \"artists\".\"style\" ILIKE '%bar%'))"
785
- ```
786
-
787
- The combinator becomes `or` instead of the default `and`, and the SQL query
788
- becomes `WHERE...OR` instead of `WHERE...AND`.
789
-
790
- This works with associations as well. Imagine an Artist model that has many
791
- Memberships, and many Musicians through Memberships:
792
-
793
- ```ruby
794
- artists = Artist.ransack(name_cont: 'foo', musicians_email_cont: 'bar', m: 'or')
795
- => Ransack::Search<class: Artist, base: Grouping <conditions: [
796
- Condition <attributes: ["name"], predicate: cont, values: ["foo"]>,
797
- Condition <attributes: ["musicians_email"], predicate: cont, values: ["bar"]>
798
- ], combinator: or>>
799
-
800
- artists.result.to_sql
801
- => "SELECT \"artists\".* FROM \"artists\"
802
- LEFT OUTER JOIN \"memberships\"
803
- ON \"memberships\".\"artist_id\" = \"artists\".\"id\"
804
- LEFT OUTER JOIN \"musicians\"
805
- ON \"musicians\".\"id\" = \"memberships\".\"musician_id\"
806
- WHERE ((\"artists\".\"name\" ILIKE '%foo%'
807
- OR \"musicians\".\"email\" ILIKE '%bar%'))"
808
- ```
809
-
810
- ### Using SimpleForm
811
-
812
- If you would like to combine the Ransack and SimpleForm form builders, set the
813
- `RANSACK_FORM_BUILDER` environment variable before Rails boots up, e.g. in
814
- `config/application.rb` before `require 'rails/all'` as shown below (and add
815
- `gem 'simple_form'` in your Gemfile).
816
-
817
- ```ruby
818
- require File.expand_path('../boot', __FILE__)
819
- ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder'
820
- require 'rails/all'
821
- ```
822
-
823
- ### I18n
824
-
825
- Ransack translation files are available in
826
- [Ransack::Locale](lib/ransack/locale). You may also be interested in one of the
827
- many translations for Ransack available at
828
- http://www.localeapp.com/projects/2999.
829
-
830
- Predicate and attribute translations in forms may be specified as follows (see
831
- the translation files in [Ransack::Locale](lib/ransack/locale) for more examples):
832
-
833
- locales/en.yml:
834
- ```yml
835
- en:
836
- ransack:
837
- asc: ascending
838
- desc: descending
839
- predicates:
840
- cont: contains
841
- not_cont: not contains
842
- start: starts with
843
- end: ends with
844
- gt: greater than
845
- lt: less than
846
- models:
847
- person: Passanger
848
- attributes:
849
- person:
850
- name: Full Name
851
- article:
852
- title: Article Title
853
- body: Main Content
854
- ```
855
-
856
- Attribute names may also be changed globally, or under `activerecord`:
857
-
858
- ```yml
859
- en:
860
- attributes:
861
- model_name:
862
- model_field1: field name1
863
- model_field2: field name2
864
- activerecord:
865
- attributes:
866
- namespace/article:
867
- title: AR Namespaced Title
868
- namespace_article:
869
- title: Old Ransack Namespaced Title
22
+ ```ruby title='Gemfile'
23
+ gem 'ransack'
870
24
  ```
871
25
 
872
- ## Mongoid
26
+ ### Bleeding edge
873
27
 
874
- Mongoid support has been moved to its own gem at [ransack-mongoid](https://github.com/activerecord-hackery/ransack-mongoid).
875
- Ransack works with Mongoid in the same way as Active Record, except that with
876
- Mongoid, associations are not currently supported. Demo source code may be found
877
- [here](https://github.com/Zhomart/ransack-mongodb-demo). A `result` method
878
- called on a `ransack` search returns a `Mongoid::Criteria` object:
28
+ If you would like to use the latest updates not yet published to RubyGems, use the `main` branch:
879
29
 
880
- ```ruby
881
- @q = Person.ransack(params[:q])
882
- @people = @q.result # => Mongoid::Criteria
883
-
884
- # or you can add more Mongoid queries
885
- @people = @q.result.active.order_by(updated_at: -1).limit(10)
30
+ ```ruby title='Gemfile'
31
+ gem 'ransack', :github => 'activerecord-hackery/ransack', :branch => 'main'
886
32
  ```
887
33
 
888
- NOTE: Ransack currently works with either Active Record or Mongoid, but not
889
- both in the same application. If both are present, Ransack will default to
890
- Active Record only. The logic is contained in
891
- `Ransack::Adapters#instantiate_object_mapper` should you need to override it.
892
-
893
- ## Semantic Versioning
894
-
895
- Ransack attempts to follow semantic versioning in the format of `x.y.z`, where:
34
+ ### Documentation
896
35
 
897
- `x` stands for a major version (new features that are not backward-compatible).
36
+ There is [extensive documentation on Ransack](https://activerecord-hackery.github.io/ransack/), which is a [Docusaurus](https://docusaurus.io/) project and run as a GitHub Pages site.
898
37
 
899
- `y` stands for a minor version (new features that are backward-compatible).
38
+ ## Issues tracker
900
39
 
901
- `z` stands for a patch (bug fixes).
40
+ * Before filing an issue, please read the [Contributing Guide](CONTRIBUTING.md).
41
+ * File an issue if a bug is caused by Ransack, is new (has not already been reported), and _can be reproduced from the information you provide_.
42
+ * Please consider adding a branch with a failing spec describing the problem.
43
+ * Contributions are welcome. :smiley:
44
+ * Please do not use the issue tracker for personal support requests. Stack Overflow or [GitHub Discussions](https://github.com/activerecord-hackery/ransack/discussions) is a better place for that where a wider community can help you!
902
45
 
903
- In other words: `Major.Minor.Patch`.
904
46
 
905
47
  ## Contributions
906
48
 
907
49
  To support the project:
908
50
 
909
- * Consider supporting via [Open Collective](https://opencollective.com/ransack/backers/badge.svg)
51
+ * Consider supporting us via [Open Collective](https://opencollective.com/ransack/backers/badge.svg)
910
52
  * Use Ransack in your apps, and let us know if you encounter anything that's
911
53
  broken or missing. A failing spec to demonstrate the issue is awesome. A pull
912
54
  request with passing tests is even better!
913
55
  * Before filing an issue or pull request, be sure to read and follow the
914
56
  [Contributing Guide](CONTRIBUTING.md).
915
- * Please use Stack Overflow or other sites for questions or discussion not
57
+ * Please use Stack Overflow or [GitHub Discussions](https://github.com/activerecord-hackery/ransack/discussions) for questions or discussion not
916
58
  directly related to bug reports, pull requests, or documentation improvements.
917
- * Spread the word on Twitter, Facebook, and elsewhere if Ransack's been useful
59
+ * Spread the word on social media if Ransack's been useful
918
60
  to you. The more people who are using the project, the quicker we can find and
919
61
  fix bugs!
920
62
 
921
63
  ## Contributors
922
64
 
923
- This project exists thanks to all the people who contribute. <img src="https://opencollective.com/ransack/contributors.svg?width=890&button=false" />
924
-
925
- Ransack is a rewrite of [MetaSearch](https://github.com/activerecord-hackery/meta_search)
926
- created by [Ernie Miller](http://twitter.com/erniemiller)
927
- and developed/maintained by:
65
+ Ransack was created by [Ernie Miller](http://twitter.com/erniemiller) and is developed and maintained by:
66
+ * [Sean Carroll](https://github.com/scarroll32)
67
+ * [Deivid Rodriguez](https://github.com/deivid-rodriguez)
68
+ * [Greg Molnar](https://github.com/gregmolnar)
69
+ * [A great group of contributors](https://github.com/activerecord-hackery/ransack/graphs/contributors).
70
+ - Ransack's logo is designed by [Anıl Kılıç](https://github.com/anilkilic).
928
71
 
929
- - [Greg Molnar](https://github.com/gregmolnar)
930
- - [Deivid Rodriguez](https://github.com/deivid-rodriguez)
931
- - [Sean Carroll](https://github.com/seanfcarroll)
72
+ Alumni Maintainers
932
73
  - [Jon Atack](http://twitter.com/jonatack)
933
74
  - [Ryan Bigg](http://twitter.com/ryanbigg)
934
- - a great group of [contributors](https://github.com/activerecord-hackery/ransack/graphs/contributors).
935
- - Ransack's logo is designed by [Anıl Kılıç](https://github.com/anilkilic).
936
-
937
- While it supports many of the same features as MetaSearch, its underlying implementation differs greatly from MetaSearch, and backwards compatibility is not a design goal.
938
75
 
76
+ This project exists thanks to all the people who contribute. <img src="https://opencollective.com/ransack/contributors.svg?width=890&button=false" />
939
77
 
940
78
 
941
79
  ## Backers
942
80
 
943
81
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/ransack#backer)]
944
82
 
945
- <a href="https://opencollective.com/ransack#backers" target="_blank"><img src="https://opencollective.com/ransack/backers.svg?width=890"></a>
83
+ <a href="https://opencollective.com/ransack#backers" target="_blank"><img src="https://opencollective.com/ransack/backers.svg?width=890" /></a>
946
84
 
947
85
 
948
86
  ## Sponsors
949
87
 
950
88
  Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/ransack#sponsor)]
951
89
 
952
- <a href="https://opencollective.com/ransack/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/0/avatar.svg"></a>
953
- <a href="https://opencollective.com/ransack/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/1/avatar.svg"></a>
954
- <a href="https://opencollective.com/ransack/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/2/avatar.svg"></a>
955
- <a href="https://opencollective.com/ransack/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/3/avatar.svg"></a>
956
- <a href="https://opencollective.com/ransack/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/4/avatar.svg"></a>
957
- <a href="https://opencollective.com/ransack/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/5/avatar.svg"></a>
958
- <a href="https://opencollective.com/ransack/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/6/avatar.svg"></a>
959
- <a href="https://opencollective.com/ransack/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/7/avatar.svg"></a>
960
- <a href="https://opencollective.com/ransack/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/8/avatar.svg"></a>
961
- <a href="https://opencollective.com/ransack/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/9/avatar.svg"></a>
90
+ <a href="https://opencollective.com/ransack/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/0/avatar.svg" /></a>
91
+ <a href="https://opencollective.com/ransack/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/1/avatar.svg" /></a>
92
+ <a href="https://opencollective.com/ransack/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/2/avatar.svg" /></a>
93
+ <a href="https://opencollective.com/ransack/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/3/avatar.svg" /></a>
94
+ <a href="https://opencollective.com/ransack/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/4/avatar.svg" /></a>
95
+ <a href="https://opencollective.com/ransack/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/5/avatar.svg" /></a>
96
+ <a href="https://opencollective.com/ransack/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/6/avatar.svg" /></a>
97
+ <a href="https://opencollective.com/ransack/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/7/avatar.svg" /></a>
98
+ <a href="https://opencollective.com/ransack/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/8/avatar.svg" /></a>
99
+ <a href="https://opencollective.com/ransack/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ransack/sponsor/9/avatar.svg" /></a>