Skip to content

Conversation

@aepstein
Copy link
Contributor

Before Rails 4, includes would also outer join tables if query conditions referenced those tables. Rails 4 has dropped this behavior in favor of making the developer explicitly identify includes that must also be joined with an additional references() method on the scope. @zeiv modified tests to use references(), but it seems better to me to incorporate this directly into the scope() method of ObligationScope. This PR reverts the Rails 4-specific tests and instead sets references in Rails >= 4.

@besief
Copy link

besief commented Jan 16, 2015

This is great and useful!

@dgm
Copy link

dgm commented Feb 25, 2016

+1 Trying to upgrade from rails 3 and running into this all over the place

@dgm
Copy link

dgm commented Feb 25, 2016

To elaborate further - The tables to include in the references depends completely upon the rules set. One role may need to reference one table, and another role may need to reference another. The knowledge of this should be handled within declarative_authorization, not in the calling code...

dgm added a commit to wested/declarative_authorization that referenced this pull request Feb 25, 2016
Use references with includes to make sure the query doesn't fail
@annaswims
Copy link

I believe this will fix my rails 4.1 problems. Thanks @aepstein

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants