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

Cannot Access Current Helpers with prevent_controller_action in TurboBoost::Commands::Command #111

Closed
ivorpad opened this issue Oct 28, 2023 · 2 comments

Comments

@ivorpad
Copy link

ivorpad commented Oct 28, 2023

Description:

When using the TurboBoost::Commands::Command class in conjunction with the prevent_controller_action method, I've found that it's impossible to access the Current module. This is causing issues, especially when trying to fetch context-based data.

Steps to reproduce:

  1. Create aCommand < TurboBoost::Commands::Command class and use the prevent_controller_action method inside it.
  2. Attempt to access any Current helper or another Rails helper method.
  3. Observe the inability to access or call these methods.

Expected Behavior:

I expected to be able to access the Current helpers inside the TurboBoost::Commands::Command class, even when the prevent_controller_action method is used.

Actual Behavior:

The Current module are inaccessible, which has caused data flow issues in our application.

Potential Solutions or Workarounds:

Currently, I'm passing necessary data from the client to the server via data- attributes. While this works, it would be more streamlined if the Current context and other helpers were accessible directly. Moreover, passing sensitive data like the current user or account through data- attributes poses a risk, as they can be tampered with on the client side.

@hopsoft
Copy link
Owner

hopsoft commented Nov 22, 2023

Does attempting to access Current raise an error or are the values missing? If the values are missing, then see this answer for a solution/work-around. #110 (comment)

@hopsoft
Copy link
Owner

hopsoft commented Nov 23, 2023

Closing in lieu of #112

@hopsoft hopsoft closed this as completed Nov 23, 2023
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

2 participants