___ / /\ / / \ / / \ / / /\ \ / / / \ \ / / / \ \ / / / /\ \ \ / / / /\ \ \ \ / / / / \ \ \ \ / / /__/____\ \ \ \ / /____________\ \ \ \ /___________________\ \ / \_______________________\/
Create cursored queries for raipidly changing data with Active Record. Useful for APIs making requests where a feed is constantly updating.
Add this line to your application's Gemfile:
gem 'cursorquery'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cursorquery
Then run migrations
rake db:migrate
Call the method cursor on any ActiveRecord query, passing in params.
Post.all.cursor(params)
Initial query returns a default amount of records (which can be overriden with the page_size param) and a unique identifier "etag". Pass etag back to subsequent queries along with previous and/or latest params. It will return new and/or older records based on the previous query, along with arrays of updated and deleted records.
- Fork it ( https://github.com/[my-github-username]/cursorquery/fork )
- 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 a new Pull Request