-
Notifications
You must be signed in to change notification settings - Fork 782
The can? and cannot? call cannot be used with a raw sql 'can' definition. #1023
Comments
having the same issue... |
Are you using |
I am not using any calls to "Can?" I have the following code in my Customer.rb model scope :for_provider, -> (provider_id) { where("provider_id = ? OR id IN (SELECT customer_id FROM customers_providers WHERE provider_id = ?)", provider_id, provider_id) } and the following code in my Ability.rb can action, Customer, Customer.for_provider |
Where does the exception occur.
This looks like something in your application is checking for a permission on a customer, with an instance of customer, that cannot be authorized with sql since you already have that instnace. |
@tjwudi @evilbikes79 I had the same issue recently. This is what I found (I realize this is an old issue but it's never too late to share the solution): |
@shubhpatel108 good solution, but better to use |
@ryanb the document is need to be update! |
@qx This extension is no longer maintained. |
be aware of "plucking" and "mapping" a large amount of data. it could lead to memory bloat |
My
shop
model anduser
have many-to-many relationship. Only the user belongs to the shop can manage the shop.I followed instructions here in order to use scope.
shop.rb
ability.rb
But I got
Is it a bug? I totally followed the documentation.
The text was updated successfully, but these errors were encountered: