upgrading to Rails 4: reverting joins where needed