Closed choilive closed 2 years ago
Figured it out.
Just needed to add include AccessGranted::Rails::ControllerMethods
into my component class and delegate current_user
through the view component helpers
escape hatch.
I think maybe you could also have delegated the can?
method to the helpers
, without include AccessGranted::Rails::ControllerMethods
?
That's a good point and probably cleaner :)
I think maybe you could also have delegated the
can?
method to thehelpers
, withoutinclude AccessGranted::Rails::ControllerMethods
?
Ah, that also works. Will try that for a future project :)
I am getting an
undefined method can?
when attempting to use access-granted inside a view component.https://github.com/github/view_component
Any ideas/suggestions in order to get this to work?