Fix joins

Joins were not filtering by the join table and also lacked integration tests.

This PR fixes the bug, adds integration tests, and also make Lou compatible with Rails 3.2 and 4.0