Mercurial > zeropaste
comparison config/initializers/wrap_parameters.rb @ 431:68eb23b52864
Rails 5 \o/
| author | nanaya <me@myconan.net> |
|---|---|
| date | Fri, 13 May 2016 03:56:07 +0900 |
| parents | 4aa8194a1733 |
| children | fd3078b4d355 |
comparison
equal
deleted
inserted
replaced
| 430:6257da6e1aa1 | 431:68eb23b52864 |
|---|---|
| 1 # Be sure to restart your server when you modify this file. | 1 # Be sure to restart your server when you modify this file. |
| 2 # | 2 |
| 3 # This file contains settings for ActionController::ParamsWrapper which | 3 # This file contains settings for ActionController::ParamsWrapper which |
| 4 # is enabled by default. | 4 # is enabled by default. |
| 5 | 5 |
| 6 # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. | 6 # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. |
| 7 ActiveSupport.on_load(:action_controller) do | 7 ActiveSupport.on_load(:action_controller) do |
| 8 wrap_parameters :format => [:json] | 8 wrap_parameters :format => [:json] |
| 9 end | 9 end |
| 10 | 10 |
| 11 # Disable root element in JSON by default. | 11 # To enable root element in JSON for ActiveRecord objects. |
| 12 ActiveSupport.on_load(:active_record) do | 12 # ActiveSupport.on_load(:active_record) do |
| 13 self.include_root_in_json = false | 13 # self.include_root_in_json = true |
| 14 end | 14 # end |
