You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
suppose I have a controller A, and an action b in there. from b i access an account by params. But I have to check this account belongs to this user or not. What I have to write in ablity class. I have tried many things. but failed. for example
can :b , Account do |portfolio|
portfolio && portfolio.user_id == user.id
end
any suggestions ?
The text was updated successfully, but these errors were encountered:
Sorry I failed to make you understand the scenario. I have a controller PortfolioGenerator. Here is a mehtod portfolio. here get a account_id as a param. Account is a different model. So I have to access this model resources. in account table there is a user_id column also.
So what should I write?
can :portfolio, user_id: user.id ()
if I write this how could cancan know it is for Account model ? and :portfolio is an action of PortfolioGenerator Controller ?
suppose I have a controller A, and an action b in there. from b i access an account by params. But I have to check this account belongs to this user or not. What I have to write in ablity class. I have tried many things. but failed. for example
can :b , Account do |portfolio|
portfolio && portfolio.user_id == user.id
end
any suggestions ?
The text was updated successfully, but these errors were encountered: