From 8c9e4d520291871e5319bc0e0a890527d8aea099 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Thu, 28 Apr 2011 15:56:11 +0700 Subject: Add `ActionController::ParamsWrapper` to wrap parameters into a nested hash This will allow us to do a rootless JSON/XML request to server. --- .../app/templates/config/initializers/wrap_parameters.rb.tt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt (limited to 'railties/lib') diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt new file mode 100644 index 0000000000..60137ed2bb --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains the settings for ActionController::ParametersWrapper +# which will be enabled by default in the upcoming version of Ruby on Rails. + +# Enable parameter wrapping for JSON. You can disable this by set :format to empty array. +ActionController::Base.wrap_parameters :format => [:json] + +# Disable root element in JSON by default. +if defined?(ActiveRecord) + ActiveRecord::Base.include_root_in_json = false +end -- cgit v1.2.3