Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define ability action name that is same as the default action aliases? #824

Open
s101d1 opened this issue Apr 28, 2023 · 0 comments

Comments

@s101d1
Copy link

s101d1 commented Apr 28, 2023

Suppose I have an action called manage in FoosController and the manage route is defined like this:

resources :foos, only: %i[update] do
  member do
    post :manage
  end
end

At first, one might think the ability for the manage action can be defined like this:

can :manage, Foo

But the manage action is one of the CanCanCan action aliases, so there is conflict with the naming.

I can set different action name in the route and controller (e.g. post :manage, action: :post_manage) for a solution, so the ability will become:

can :post_manage, Foo

But I'm wondering is there a workaround to keep the manage action name for Foo in ability without getting name conflict with the manage action alias?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant