The error above comes from the require() method in ActiveSupport::Dependencies::Loadable being executed when calling
params.require(:user)... strong_parameters injects ActionController::StrongParameters into ActionController::Base at the bottom of this file with
ActionController::Base.send :include, ActionController::StrongParameters The rails-api gem requires your app's ApplicationController extend ActionController::API in favor of ActionController::Base
The application controllers don't know anything about ActionController::StrongParametersbecause they're not extending the class ActionController::StrongParameters was included within. This is why the require() method call is not calling the implementation in ActionController::StrongParameters.
To tell ActionController::API about ActionController::StrongParameters is as simple as adding the following to a file in config/initializers.
ActionController::API.send :include, ActionController::StrongParameters
No comments:
Post a Comment