[skip ci] Update docs concerning Active Record XOR Mongoid
- Ransack does work if both are present; it just defaults to AR. - Use 'Active Record' (not 'ActiveRecord') following Rails current convention. - Provide the code logic. - Line wrap at 80 characters.
This commit is contained in:
parent
d2a173af59
commit
b2f7b422ca
11
README.md
11
README.md
|
@ -656,7 +656,16 @@ called on a `ransack` search returns a `Mongoid::Criteria` object:
|
|||
@people = @q.result.active.order_by(updated_at: -1).limit(10)
|
||||
```
|
||||
|
||||
_NOTE: You can't use ActiveRecord and Mongoid in the same App at the moment. Mongoid works only if you don't have ActiveRecord in your Gemfile and and vice versa._
|
||||
_NOTE: Ransack currently works with either Active Record or Mongoid, but not
|
||||
both in the same application. If both are present, Ransack will default to
|
||||
Active Record only. Here is the code containing the logic:_
|
||||
|
||||
```ruby
|
||||
@current_adapters ||= {
|
||||
:active_record => defined?(::ActiveRecord::Base),
|
||||
:mongoid => defined?(::Mongoid) && !defined?(::ActiveRecord::Base)
|
||||
}
|
||||
```
|
||||
|
||||
## Semantic Versioning
|
||||
|
||||
|
|
Loading…
Reference in New Issue