Just to expand the answer of the arc, and for those who can still stumble upon this problem,
This problem can also occur more specifically when the controller method used for POST HTTP requests displays JSON instead of redirecting. If this method has before_action, and that before the action it tries "redirect_to" instead of rendering JSON, as it was originally intended, an error occurs.
To fix this, just make sure your before_action for this method also displays the response, rather than trying to redirect it.
Example:
before_action :require_configuration_training def locations_post response = 'hey' render json: response, status: 200 end def require_configuration_training response = 'hi'
source share