ActionController::ParamsWrapper
module ActionController::ParamsWrapper
Wraps the parameters hash into a nested hash. This will allow clients to submit requests without having to specify any root elements.
This functionality is enabled in config/initializers/wrap_parameters.rb
and can be customized.
You could also turn it on per controller by setting the format array to a non-empty array:
class UsersController < ApplicationController wrap_parameters format: [:json, :xml, :url_encoded_form, :multipart_form] end
If you enable ParamsWrapper
for :json
format, instead of having to send JSON parameters like this:
{"user": {"name": "Konata"}}
You can send parameters like this:
{"name": "Konata"}
And it will be