Open aepstein opened 10 years ago
This is great and useful!
+1 Trying to upgrade from rails 3 and running into this all over the place
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...
I believe this will fix my rails 4.1 problems. Thanks @aepstein
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.