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

NameError - undefined local variable or method view_context for controller inheriting from ActionController::API #209

Open
ravibhusal opened this issue Jan 25, 2022 · 0 comments

Comments

@ravibhusal
Copy link

ravibhusal commented Jan 25, 2022

Rails version: 6.0.3.6
Filterrific version: 5.2.1

As the title says, I am getting NameError - undefined local variable or method view_context when trying to use Filterrific in a controller inheriting from ActionController::API.

I have traced down the problem to

when String
helpers.sanitize(val)
else

where the helpers method calls view_context which is undefined because its not available for ActionController::API. I think it makes sense.

For now, I can set sanitize_param to false and sanitize the params myself. I just want to make sure its an actual issue and not just something occurring only on my end because of some misconfiguration.

Thank you for the help and the gem!

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