Parses natural language queries with Chronic when searching time/date columns with Ransack
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install ransack_chronic
This gem will override Ransack's
cast_to_time methods to allow natural language date queries.
You will now be able search on date columns with queries like "1 week ago", "2 days from now" or "thursday last week".
Take a look at the Chronic docs for more examples.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request