left_join

This gem helps you doing LEFT JOINs between your ActiveRecord associations, so you can do this:

Book.left_join(:category)
# SELECT "books".* FROM "books"
# LEFT OUTER JOIN "categories"
# ON "books"."category_id" = "categories"."id"

Why?

See this blog post for details.

Installation

Add to your Gemfile:

gem 'left_join'

Or install it manually

gem install left_join

Contributing

Copyright © 2015 Diego Aguir Selzlein. See LICENSE.txt for further details.