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.
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.
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 fromActionController::API
.I have traced down the problem to https://github.com/jhund/filterrific/blob/312d071081a6c5ec80995c76cdb707e8097e2964/lib/filterrific/action_controller_extension.rb#L101-L103
where the helpers method calls
view_context
which is undefined because its not available forActionController::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!