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

Best way to get the current resource name #1762

seguidor777 opened this issue Aug 13, 2019 · 1 comment


Copy link

commented Aug 13, 2019


I am working on a feature that uses policies to authorize requests basing on a user role, an action and a resource.

I have no problem to get the first two, but I am facing issues with getting the resource name, since I only have the full path. Is there any efficient way to get that with any function similar to controller_name from Rails?


This comment has been minimized.

Copy link

commented Aug 13, 2019

I could extract the resource name from the name of the handler, for example:
handlerName: = c.Data()["current_route"].(buffalo.RouteInfo).HandlerName

Lets suppose that handlerName is something like ""
And with some regexp stuff I capture the UsersResource string, but this does not convince me at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.