aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2011-05-02 14:08:44 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2011-05-02 14:08:44 -0700
commit79a9bebcbf53673cab5d588869819702ac5a9607 (patch)
treebc7fd211afdd2424f62d90d8637d351c0664c7f5 /railties/lib
parent7f5ff5df2dc2dd8d9aea4e3d944b41f89e1fb3da (diff)
parent8c9e4d520291871e5319bc0e0a890527d8aea099 (diff)
downloadrails-79a9bebcbf53673cab5d588869819702ac5a9607.tar.gz
rails-79a9bebcbf53673cab5d588869819702ac5a9607.tar.bz2
rails-79a9bebcbf53673cab5d588869819702ac5a9607.zip
Merge pull request #359 from sikachu/params_wrapper.
Add `ActionController::ParamsWrapper` to wrap JSON parameters into a nested parameters.
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