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. If you are upgrading to Rails 3.1, this file will need to be created for the functionality to be enabled.
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 par