-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Using turbo boost elements with cancancan #110
Comments
@hopsoft @julianrubisch I'm having a hard time figuring this out. What I can tell is that whatever I do to set my |
hmm the first question would be if you see anything in the JS console going wrong. then, commands will fail loudly if anything goes wrong on the server side, so... this might not be the case looking at the elements' command it does use other than that I fear I only have the canonical answer of "please provide us an MVCE" 🤷♂️ |
This seems to be exactly the problem. Any chance to run some before_command hook or otherwise set up the necessary current attributes? I'd also greatly appreciate any alternative suggestions. It seems like a perfectly valid use case to me so curious how to continue. |
@hopsoft you must've come across this? Typically this is set in application_command but with elements I suppose we'd have to supply a config option? |
Commands run as a before action, but the command before action is effectively prepended and executes before other before actions. This means you'll need to ensure that you perform any setup that the command may need like Here's an example of how to do this. https://github.com/hopsoft/turbo_boost-commands/blob/eb2f5cd4a533ec3fbab38d6aed1e16804f77a474/test/dummy/app/controllers/application_controller.rb |
That works like a charm; just some documentation missing! |
Yeah. I definitely need to carve out some time to improve the docs and demos. |
Closing in lieu of #112 |
I am trying to build a minimal CMS. For reasons you know about, I decided to give turbo_boost a try. First, to show how I want it to work, I recorded a little video without the
can?
check.Now, if I add cancancan and a
can?
check, I can only click once. Anything within thatcan?
check is rendered only on page load, not on clicking the command buttons.Something like hotwired/turbo-rails#243, perhaps?
PS. I opened the issue on turbo_boost-commands instead of turbo_boost-elements because it doesn't have much to do with elements, as it is the command that executes that is missing a current user, current ability, or some such.
If that is a wrong assumption, let me know, and I will close and open an issue on elements instead.
Now that I feel lighter, I will debug this issue myself. Wish me luck 🍀
The text was updated successfully, but these errors were encountered: