diff --git a/CHANGELOG.md b/CHANGELOG.md index dbe93ab..a31c5ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ henceforth should be documented here. ## Master (Unreleased) ### Added +* Add support for `mongoid 4.0` without associations ([pull request](https://github.com/activerecord-hackery/ransack/pull/407)). + + *Zhomart Mukhamejanov* + ### Fixed * Add support and tests for passing stringy booleans for ransackable scopes diff --git a/README.md b/README.md index 5d5730e..0ab653e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ instead. ## Getting started -Ransack is currently compatible with Rails 3.x, 4.0, 4.1 and 4.2. +Ransack is currently compatible with Rails 3.x, 4.0, 4.1 and 4.2. Since 1.6.0 added support for Mongoid 4.0 without associations. In your Gemfile, for the last officially released Ransack gem: @@ -595,6 +595,19 @@ en: title: Old Ransack Namespaced Title ``` +### Mongoid + +Usage of ransack with Mongoid is same as with ActiveRecord. Currently ransack doesn't support Mongoid's associations. [Here](http://ransack-mongodb-demo.herokuapp.com/) is the demo application (demo source code is [here](https://github.com/Zhomart/ransack-mongodb-demo). `result` method of `Ransack::Search` returns `Mongoid::Criteria`: + +```ruby +@q = Person.search(params[:q]) +@people = @q.result # => Mongoid::Criteria + +# or you can add more Mongoid queries +@people = @q.result.active.order_by(updated_at: -1).limit(10) +``` + + ## Semantic Versioning Ransack attempts to follow semantic versioning in the format of `x.y.z`, where: