ransack 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +40 -22
  3. data/CHANGELOG.md +176 -27
  4. data/CONTRIBUTING.md +30 -19
  5. data/Gemfile +8 -3
  6. data/README.md +131 -58
  7. data/Rakefile +5 -2
  8. data/lib/ransack.rb +10 -5
  9. data/lib/ransack/adapters.rb +43 -23
  10. data/lib/ransack/adapters/active_record.rb +2 -2
  11. data/lib/ransack/adapters/active_record/3.0/compat.rb +5 -5
  12. data/lib/ransack/adapters/active_record/3.0/context.rb +5 -3
  13. data/lib/ransack/adapters/active_record/3.1/context.rb +1 -4
  14. data/lib/ransack/adapters/active_record/base.rb +12 -1
  15. data/lib/ransack/adapters/active_record/context.rb +148 -55
  16. data/lib/ransack/adapters/active_record/ransack/constants.rb +53 -53
  17. data/lib/ransack/adapters/active_record/ransack/context.rb +3 -1
  18. data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +20 -28
  19. data/lib/ransack/adapters/mongoid/base.rb +21 -6
  20. data/lib/ransack/adapters/mongoid/context.rb +9 -5
  21. data/lib/ransack/configuration.rb +24 -3
  22. data/lib/ransack/constants.rb +11 -22
  23. data/lib/ransack/context.rb +20 -13
  24. data/lib/ransack/helpers/form_builder.rb +5 -6
  25. data/lib/ransack/helpers/form_helper.rb +50 -69
  26. data/lib/ransack/locale/da.yml +70 -0
  27. data/lib/ransack/locale/id.yml +70 -0
  28. data/lib/ransack/locale/ja.yml +70 -0
  29. data/lib/ransack/locale/pt-BR.yml +70 -0
  30. data/lib/ransack/locale/{zh.yml → zh-CN.yml} +1 -1
  31. data/lib/ransack/locale/zh-TW.yml +70 -0
  32. data/lib/ransack/nodes.rb +1 -1
  33. data/lib/ransack/nodes/attribute.rb +4 -1
  34. data/lib/ransack/nodes/bindable.rb +18 -6
  35. data/lib/ransack/nodes/condition.rb +58 -28
  36. data/lib/ransack/nodes/grouping.rb +15 -4
  37. data/lib/ransack/nodes/sort.rb +9 -5
  38. data/lib/ransack/predicate.rb +6 -2
  39. data/lib/ransack/search.rb +6 -5
  40. data/lib/ransack/translate.rb +2 -2
  41. data/lib/ransack/version.rb +1 -1
  42. data/ransack.gemspec +4 -4
  43. data/spec/mongoid/adapters/mongoid/base_spec.rb +20 -1
  44. data/spec/mongoid/nodes/condition_spec.rb +15 -0
  45. data/spec/mongoid/support/mongoid.yml +5 -0
  46. data/spec/mongoid/support/schema.rb +4 -0
  47. data/spec/mongoid_spec_helper.rb +13 -9
  48. data/spec/ransack/adapters/active_record/base_spec.rb +249 -71
  49. data/spec/ransack/adapters/active_record/context_spec.rb +16 -18
  50. data/spec/ransack/helpers/form_builder_spec.rb +5 -2
  51. data/spec/ransack/helpers/form_helper_spec.rb +84 -14
  52. data/spec/ransack/nodes/condition_spec.rb +24 -0
  53. data/spec/ransack/nodes/grouping_spec.rb +56 -0
  54. data/spec/ransack/predicate_spec.rb +5 -5
  55. data/spec/ransack/search_spec.rb +79 -70
  56. data/spec/support/schema.rb +43 -29
  57. metadata +17 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a62534d07f2b79f6ac71228f7b8884c2f97891f
4
- data.tar.gz: 983a58938313d8b5ded1e13ff182f0ee1c27ee48
3
+ metadata.gz: 0a6333c22fc3b35aec6fea8a410ec2705e570031
4
+ data.tar.gz: ae8c1df141e8944b0509ba07d2e50d19b9c14c66
5
5
  SHA512:
6
- metadata.gz: eb11af400660331859ddeeb11819d14849fd398ffe3b00368c860ee47baeeace67cb29116d15b46dcad92f1466bb19d6f9e85070baea384ef49500ad1aa1e3a1
7
- data.tar.gz: 5ed69b32c4bd6a65b60e8dd2cccb5c634738b8fe3a3a7266ccc5c6a67ab2b720b016afbfcd8e7740c0ed76dea0c00d46db0c8a61b545b7e7ff66d324bd1057d3
6
+ metadata.gz: d6ed3d7bc6024116ac43c27888dc98b77ce265bab21046c7ac9dd0cb98a12077d7cf8ded176b073f825d11c92cbd02433b29ee5224b858bd5208e1a3edb19724
7
+ data.tar.gz: 9a6a06c4ee47b701e2ba2f6f29007c5dd00b16a34f7bbb57f9bada3d787a1caf2b6db8107dfaf5cdc0ac433665bc03e86a3e21c15a9e30daff509df5ea043c8d
@@ -1,22 +1,23 @@
1
- services: mongodb
2
-
3
1
  language: ruby
4
2
 
5
3
  sudo: false
6
4
 
7
5
  rvm:
8
- - 2.2.3
9
- - 2.1
6
+ - 2.3.1
7
+ - 2.2.5
8
+ - 2.1.10
10
9
  - 2.0
11
10
  - 1.9
12
11
 
13
12
  env:
14
- - RAILS=4-2-stable DB=mongodb
13
+ - RAILS=5-0-stable DB=sqlite3
14
+ - RAILS=5-0-stable DB=mysql
15
+ - RAILS=5-0-stable DB=postgres
16
+
15
17
  - RAILS=4-2-stable DB=sqlite3
16
18
  - RAILS=4-2-stable DB=mysql
17
19
  - RAILS=4-2-stable DB=postgres
18
20
 
19
- - RAILS=4-1-stable DB=mongodb
20
21
  - RAILS=4-1-stable DB=sqlite3
21
22
  - RAILS=4-1-stable DB=mysql
22
23
  - RAILS=4-1-stable DB=postgres
@@ -34,30 +35,47 @@ env:
34
35
  - RAILS=3-1-stable DB=postgres
35
36
 
36
37
  matrix:
38
+ exclude:
39
+ - rvm: 2.1.10
40
+ env: RAILS=5-0-stable DB=sqlite3
41
+ - rvm: 2.1.10
42
+ env: RAILS=5-0-stable DB=mysql
43
+ - rvm: 2.1.10
44
+ env: RAILS=5-0-stable DB=postgres
45
+
46
+ - rvm: 2.0
47
+ env: RAILS=5-0-stable DB=sqlite3
48
+ - rvm: 2.0
49
+ env: RAILS=5-0-stable DB=mysql
50
+ - rvm: 2.0
51
+ env: RAILS=5-0-stable DB=postgres
52
+
53
+ - rvm: 1.9
54
+ env: RAILS=5-0-stable DB=sqlite3
55
+ - rvm: 1.9
56
+ env: RAILS=5-0-stable DB=mysql
57
+ - rvm: 1.9
58
+ env: RAILS=5-0-stable DB=postgres
59
+
37
60
  include:
38
- - rvm: 2.2.3
61
+ - rvm: 2.3.1
39
62
  env: RAILS=master DB=sqlite3
40
- - rvm: 2.2.3
63
+ - rvm: 2.3.1
41
64
  env: RAILS=master DB=mysql
42
- - rvm: 2.2.3
65
+ - rvm: 2.3.1
43
66
  env: RAILS=master DB=postgres
44
- exclude:
45
- - rvm: 2.2.3
46
- env: RAILS=3-1-stable DB=sqlite
47
- - rvm: 2.2.3
48
- env: RAILS=3-1-stable DB=mysql
49
- - rvm: 2.2.3
50
- env: RAILS=3-1-stable DB=postgres
67
+
68
+ - rvm: 2.2.5
69
+ env: RAILS=master DB=sqlite3
70
+ - rvm: 2.2.5
71
+ env: RAILS=master DB=mysql
72
+ - rvm: 2.2.5
73
+ env: RAILS=master DB=postgres
74
+
51
75
  allow_failures:
52
76
  - env: RAILS=master DB=sqlite3
53
77
  - env: RAILS=master DB=mysql
54
78
  - env: RAILS=master DB=postgres
55
- - rvm: 2.2.3
56
- env: RAILS=3-2-stable DB=sqlite
57
- - rvm: 2.2.3
58
- env: RAILS=3-2-stable DB=mysql
59
- - rvm: 2.2.3
60
- env: RAILS=3-2-stable DB=postgres
61
79
 
62
80
  before_script:
63
81
  - mysql -e 'create database ransack collate utf8_general_ci;'
@@ -1,9 +1,171 @@
1
1
  # Change Log
2
2
 
3
- ## Unreleased
3
+ ## Version 1.8.0 - 2016-07-14
4
+ ### Added
5
+
6
+ * Support Mongoid 5. PR [#636](https://github.com/activerecord-hackery/ransack/pull/636), commit
7
+ [9e5faf4](https://github.com/activerecord-hackery/ransack/commit/9e5faf4).
8
+
9
+ *Josef Šimánek*
10
+
11
+ * Added optional block argument for the `sort_link` method. PR
12
+ [#604](https://github.com/activerecord-hackery/ransack/pull/604).
13
+
14
+ *Andrea Dal Ponte*
15
+
16
+ * Added `ransack_alias` to allow users to customize the names for long
17
+ ransack field names. PR
18
+ [#623](https://github.com/activerecord-hackery/ransack/pull/623).
19
+
20
+ *Ray Zane*
21
+
22
+ * Added support for searching on attributes that have been added to
23
+ Active Record models with `alias_attribute` (Rails >= 4 only). PR
24
+ [#592](https://github.com/activerecord-hackery/ransack/pull/592), commit
25
+ [549342a](https://github.com/activerecord-hackery/ransack/commit/549342a).
26
+
27
+ *Marten Schilstra*
28
+
29
+ * Add ability to globally hide sort link order indicator arrows with
30
+ `Ransack.configure#hide_sort_order_indicators = true`. PR
31
+ [#577](https://github.com/activerecord-hackery/ransack/pull/577), commit
32
+ [95d4591](https://github.com/activerecord-hackery/ransack/commit/95d4591).
33
+
34
+ *Josh Hunter*, *Jon Atack*
35
+
36
+ * Add test for `ActionController:Parameter` object params in `sort_link` to
37
+ ensure Ransack is handling the Rails 5 changes correctly. Commit
38
+ [b1cfed8](https://github.com/activerecord-hackery/ransack/commit/b1cfed8).
39
+
40
+ *Ryan Wood*
41
+
42
+ * Add failing tests to facilitate work on issue
43
+ [#566](https://github.com/activerecord-hackery/ransack/issues/566)
44
+ of passing boolean values to search scopes. PR
45
+ [#575](https://github.com/activerecord-hackery/ransack/pull/575).
46
+
47
+ *Marcel Eeken*
48
+
49
+ * Add Taiwanese Hokkien/Mandarin i18n locale file (`zh-TW.yml`). PR
50
+ [#674](https://github.com/activerecord-hackery/ransack/pull/674).
51
+
52
+ *Sibevin Wang*
53
+
54
+ * Add Danish i18n locale file (`da.yml`). PR
55
+ [#663](https://github.com/activerecord-hackery/ransack/pull/663).
56
+
57
+ *Kasper Johansen*
58
+
59
+ * Add Brazilian Portuguese i18n locale file (`pt-BR.yml`). PR
60
+ [#581](https://github.com/activerecord-hackery/ransack/pull/581).
61
+
62
+ *Diego Henrique Domingues*
63
+
64
+ * Add Indonesian (Bahasa) i18n locale file (`id.yml`). PR
65
+ [#612](https://github.com/activerecord-hackery/ransack/pull/612).
66
+
67
+ *Adam Pahlevi Baihaqi*
68
+
69
+ * Add Japanese i18n locale file (`ja.yml`). PR
70
+ [#622](https://github.com/activerecord-hackery/ransack/pull/622).
71
+
72
+ *Masanobu Mizutani*
73
+
74
+ ### Fixed
75
+
76
+ * In `FormHelper::SortLink#parameters_hash`, convert `params#to_unsafe_h`
77
+ only if Rails 5, and add tests. Commit
78
+ [14e66ca](https://github.com/activerecord-hackery/ransack/commit/14e66ca).
79
+
80
+ *Jon Atack*
81
+
82
+ * Respect negative conditions for collection associations and fix Mongoid
83
+ compat. PR [#645](https://github.com/activerecord-hackery/ransack/pull/645).
84
+
85
+ *Andrew Vit*
86
+
87
+ * Ensure conditions differing only by ransacker_args aren't filtered out.
88
+ PR [#665](https://github.com/activerecord-hackery/ransack/pull/665).
89
+
90
+ *Andrew Porterfield*
91
+
92
+ * Fix using aliased attributes in association searches, and add a failing
93
+ spec. PR [#602](https://github.com/activerecord-hackery/ransack/pull/602).
94
+
95
+ *Marten Schilstra*
96
+
97
+ * Replace Active Record `table_exists?` API that was deprecated
98
+ [here](https://github.com/rails/rails/commit/152b85f) in Rails 5. Commit
99
+ [c9d2297](https://github.com/activerecord-hackery/ransack/commit/c9d2297).
100
+
101
+ *Jon Atack*
102
+
103
+ * Adapt to changes in Rails 5 where AC::Parameters composes a HWIA instead of
104
+ inheriting from Hash starting from Rails commit rails/rails@14a3bd5. Commit
105
+ [ceafc05](https://github.com/activerecord-hackery/ransack/commit/ceafc05).
106
+
107
+ *Jon Atack*
108
+
109
+ * Fix test `#sort_link with hide order indicator set to true` to fail properly
110
+ ([4f65b09](https://github.com/activerecord-hackery/ransack/commit/4f65b09)).
111
+ This spec, added in
112
+ [#473](https://github.com/activerecord-hackery/ransack/pull/473), tested
113
+ the presence of the attribute name instead of the absence of the order
114
+ indicators and did not fail when it should.
115
+
116
+ *Josh Hunter*, *Jon Atack*
117
+
118
+ * Fix rspec-mocks `stub` deprecation warnings when running the tests. Commit
119
+ [600892e](https://github.com/activerecord-hackery/ransack/commit/600892e).
120
+
121
+ *Jon Atack*
122
+
123
+ * Revert
124
+ [f858dd6](https://github.com/activerecord-hackery/ransack/commit/f858dd6).
125
+ Fixes [#553](https://github.com/activerecord-hackery/ransack/issues/553)
126
+ performance regression with the SQL Server adapter.
127
+
128
+ *sschwing3*
129
+
130
+ * Fix invalid Chinese I18n locale file name by replacing "zh" with "zh-CN".
131
+ PR [#590](https://github.com/activerecord-hackery/ransack/pull/590).
4
132
 
133
+ *Ethan Yang*
134
+
135
+ ### Changed
136
+
137
+ * Memory/speed perf improvement: Freeze strings in array global constants and
138
+ partially move from using global string constants to frozen strings
139
+ ([381a83c](https://github.com/activerecord-hackery/ransack/commit/381a83c)
140
+ and
141
+ [ce114ec](https://github.com/activerecord-hackery/ransack/commit/ce114ec)).
142
+
143
+ *Jon Atack*
144
+
145
+ * Escape underscore `_` wildcard characters with PostgreSQL and MySQL. PR
146
+ [#584](https://github.com/activerecord-hackery/ransack/issues/584).
147
+
148
+ *Igor Dobryn*
149
+
150
+ * Refactor `Ransack::Adapters` from conditionals to classes
151
+ ([94a404c](https://github.com/activerecord-hackery/ransack/commit/94a404c)).
152
+
153
+ *Jon Atack*
5
154
 
6
155
  ## Version 1.7.0 - 2015-08-20
156
+ ### Added
157
+
158
+ * Add Mongoid support for referenced/embedded relations. PR
159
+ [#498](https://github.com/activerecord-hackery/ransack/pull/498).
160
+ TODO: Missing spec coverage! Add documentation!
161
+
162
+ *Penn Su*
163
+
164
+ * Add German i18n locale file (`de.yml`). PR
165
+ [#537](https://github.com/activerecord-hackery/ransack/pull/537).
166
+
167
+ *Philipp Weissensteiner*
168
+
7
169
  ### Fixed
8
170
 
9
171
  * Fix
@@ -44,8 +206,8 @@
44
206
 
45
207
  *Andrew Vit*
46
208
 
47
- * Fix RSpec `its` method deprecation warning: 'Use of rspec-core's `its`
48
- method is deprecated. Use the rspec-its gem instead
209
+ * Fix RSpec `its` method deprecation warning: "Use of rspec-core's its
210
+ method is deprecated. Use the rspec-its gem instead"
49
211
  ([c09aa17](https://github.com/activerecord-hackery/ransack/commit/c09aa17)).
50
212
 
51
213
  * Fix deprecated RSpec syntax in `grouping_spec.rb`
@@ -53,24 +215,11 @@
53
215
 
54
216
  *Jon Atack*
55
217
 
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
218
  ### Changed
70
219
 
71
220
  * Upgrade gemspec dependencies: MySQL2 from '0.3.14' to '0.3.18', and RSpec
72
221
  from '~> 2.14.0' to '~> 2' which loads 2.99
73
- ([000cd2](https://github.com/activerecord-hackery/ransack/commit/000cd2)).
222
+ ([000cd22](https://github.com/activerecord-hackery/ransack/commit/000cd22)).
74
223
 
75
224
  * Upgrade spec suite to RSpec 3 `expect` syntax backward compatible with
76
225
  RSpec 2.9
@@ -89,10 +238,12 @@
89
238
 
90
239
 
91
240
  ## Version 1.6.6 - 2015-04-05
92
- ### Changed
241
+ ### Added
93
242
 
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).
243
+ * Add the Ruby version to the the header message that shows the database,
244
+ Active Record and Arel versions when running tests.
245
+
246
+ * Add Code Climate analysis.
96
247
 
97
248
  *Jon Atack*
98
249
 
@@ -117,12 +268,10 @@
117
268
 
118
269
  *Jon Atack*
119
270
 
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.
271
+ ### Changed
124
272
 
125
- * Add Code Climate analysis.
273
+ * Upgrade Polyamorous dependency to version 1.2.0, which uses `Module#prepend`
274
+ instead of `alias_method` for hooking into Active Record (with Ruby 2.x).
126
275
 
127
276
  *Jon Atack*
128
277
 
@@ -239,7 +388,7 @@
239
388
 
240
389
  *Josh Kovach*
241
390
 
242
- * Add an sort_link option to not display sort direction arrows
391
+ * Add an sort_link option to not display sort order indicator arrows
243
392
  ([PR #473](https://github.com/activerecord-hackery/ransack/pull/473)).
244
393
 
245
394
  *Fred Bergman*
@@ -427,7 +576,7 @@
427
576
 
428
577
  *Pedro Chambino*
429
578
 
430
- * Add `ro.yml` Romanian translation file.
579
+ * Add Romanian i18n locale file (`ro.yml`).
431
580
 
432
581
  *Andreas Philippi*
433
582
 
@@ -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** — check if the issue has already been
@@ -22,18 +22,25 @@ Steps:
22
22
  2. **Check if the issue has been fixed** — try to reproduce it using the
23
23
  `master` branch in the repository.
24
24
 
25
- 3. **Isolate and report the problem** — ideally create a reduced test
26
- case.
25
+ 3. **Isolate the real problem** — make sure the issue is really a bug in
26
+ Ransack and not in your code or another gem.
27
+
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!
27
32
 
28
- When filing an issue, please provide these details:
33
+ If you do not provide a self-contained gist and would like your issue to be reviewed, do provide at a minimum:
29
34
 
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.
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
 
@@ -80,20 +87,24 @@ Here's a quick guide:
80
87
  8. Update the Change Log. If you are adding new functionality, document it in
81
88
  the README.
82
89
 
83
- 9. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
90
+ 9. Make sure git knows your name and email address in your `~/.gitconfig` file:
91
+
92
+ $ git config --global user.name "Your Name"
93
+ $ git config --global user.email "contributor@example.com"
94
+
95
+ 10. Commit your changes (`git commit -am 'Add feature/fix bug/improve docs'`).
96
+ If your pull request only contains documentation changes, please remember
97
+ to add `[skip ci]` to the beginning of your commit message so the Travis
98
+ test suite doesn't :runner: needlessly.
84
99
 
85
- 10. If necessary, rebase your commits into logical chunks, without errors. To
100
+ 11. If necessary, rebase your commits into logical chunks, without errors. To
86
101
  interactively rebase and cherry-pick from, say, the last 10 commits:
87
102
  `git rebase -i HEAD~10`, then `git push -f`.
88
103
 
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
104
+ 12. Push the branch up to your fork on GitHub
105
+ (`git push origin my-new-feature`) and from GitHub submit a pull request to
91
106
  Ransack's `master` branch.
92
107
 
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
108
  At this point you're waiting on us. We like to at least comment on, if not
98
109
  accept, pull requests within three business days (and, typically, one business
99
110
  day). We may suggest some changes or improvements or alternatives.
data/Gemfile CHANGED
@@ -3,13 +3,14 @@ gemspec
3
3
 
4
4
  gem 'rake'
5
5
 
6
- rails = ENV['RAILS'] || '4-2-stable'
6
+ rails = ENV['RAILS'] || '5-0-stable'
7
7
 
8
8
  if rails == 'master'
9
+ gem 'rack', github: 'rack/rack'
9
10
  gem 'arel', github: 'rails/arel'
10
11
  gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
11
12
  else
12
- gem 'polyamorous', '~> 1.2'
13
+ gem 'polyamorous', '~> 1.3'
13
14
  end
14
15
 
15
16
  gem 'pry'
@@ -41,10 +42,14 @@ else
41
42
  end
42
43
  end
43
44
 
44
- if ENV['DB'] =~ /mongodb/
45
+ if ENV['DB'] =~ /mongoid4/
45
46
  gem 'mongoid', '~> 4.0.0', require: false
46
47
  end
47
48
 
49
+ if ENV['DB'] =~ /mongoid5/
50
+ gem 'mongoid', '~> 5.0.0', require: false
51
+ end
52
+
48
53
  # Removed from Ruby 2.2 but needed for testing Rails 3.x.
49
54
  group :test do
50
55
  gem 'test-unit', '~> 3.0' if RUBY_VERSION >= '2.2'