aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-04-28 15:56:11 +0700
committerPrem Sichanugrist <s@sikachu.com>2011-05-03 03:21:43 +0700
commit8c9e4d520291871e5319bc0e0a890527d8aea099 (patch)
treed6733837636fe79992e5deb9702b65f98c7cdd6a /railties/lib
parent23eb81a3d1eb154a3aefe569408d1bb2ed63c554 (diff)
downloadrails-8c9e4d520291871e5319bc0e0a890527d8aea099.tar.gz
rails-8c9e4d520291871e5319bc0e0a890527d8aea099.tar.bz2
rails-8c9e4d520291871e5319bc0e0a890527d8aea099.zip
Add `ActionController::ParamsWrapper` to wrap parameters into a nested hash
This will allow us to do a rootless JSON/XML request to server.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt12
1 files changed, 12 insertions, 0 deletions
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