cancan
cancan copied to clipboard
Abilities with multiple conditions on Nested Resources Broken
Assuming we're using cancan 1.6.10 (not a problem in 1.6.9) and our classes have this kind of relationship:
class User belongs_to :parent_a belongs_to :parent_b has_many :resource_a end
Abilities defined as:
can :manage, ResourceA, :user => { :parent_a => [1,2,3], :parent_b => [4,5,6] }
Will fail because on the second go around of the second/inside inject call the tableized_conditions method in the ActiveRecordAdapter class, the name of the table has been changed to 'users' instead of user.
I would have stuck in there and posted a fix but I unfortunately do not have the time currently. If this issue is still open in a few days I will submit a pull request.
If you need any more information in the meantime, please let me know.
:+1: I have the exact same problem, it only fails in production never in my tests.
Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013. Since only Ryan himself has commit permissions, the CanCan project is on a standstill.
CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.
If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.
We hope to see you on the other side!