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
# routes.rb
resources :plans do
collection do
get 'requested'
get 'pending'
end
end
# PlansController
load_and_authorize_resource
def requested
...
render :index
end
def pending
...
render :index
end
# Ability
can :requested, Plan, dept_id: 304
can :pending, Plan, status: 'sent'
Where 'request' and 'pending' are two collection actions which should list the plans based on the respective filter. Problem is, if I don't add:
can :index, Plan
I get nothing. If I add this, it will show everything in both actions. In this cases, it seems that CanCan locks the actions, but is ignoring the conditions.
Any idea on how to solve this? Am I doing it wrong or not understanding something?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Suppose I have the following:
Where 'request' and 'pending' are two collection actions which should list the plans based on the respective filter. Problem is, if I don't add:
I get nothing. If I add this, it will show everything in both actions. In this cases, it seems that CanCan locks the actions, but is ignoring the conditions.
Any idea on how to solve this? Am I doing it wrong or not understanding something?
Thanks in advance.
The text was updated successfully, but these errors were encountered: