RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

Find next / previous ActiveRecord records out of the scope in one query

ActiveRecord extension to find out near by (proximal) records (previous and next) from the ActiveRelation scopes (tried to use AREL as much as possible).

The benefit of this gem, it can take any scope, and it does subquery for taking previous and next records. You don't need to add anything, just include module and use magic function that will do everything for you.

Currently supported adapters: mysql2 and postgresql.

Tested Ruby: 1.9.3, 2.0.0, 2.1.1
Tested ActiveRecord: 3.2, 4.0, 4.1

Current roadmap is to write more specs and add sqlite3 adapter.

Download proximal_records gem


Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!