RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in