Enable Rails 7's framework wrap_parameters_by_default & cookies_serializer (#17984)
This commit is contained in:
parent
88f0d946da
commit
9dd52c24e1
4 changed files with 8 additions and 38 deletions
|
|
@ -50,6 +50,14 @@ module PracticalDeveloper
|
|||
|
||||
# Make `form_with` generate non-remote forms by default. We want this to be true as it was the default in 5.2
|
||||
config.action_view.form_with_generates_remote_forms = true
|
||||
|
||||
## Rails 7.0
|
||||
config.action_dispatch.cookies_serializer = :json
|
||||
|
||||
# Enable parameter wrapping for JSON.
|
||||
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
|
||||
# To disable parameter wrapping entirely, set this config to `false`.
|
||||
config.action_controller.wrap_parameters_by_default = false
|
||||
### END FRAMEWORK DEFAULT OVERIDES
|
||||
|
||||
# Disable auto adding of default load paths to $LOAD_PATH
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
|
|
@ -69,23 +69,6 @@ Rails.application.config.active_record.partial_inserts = false
|
|||
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
|
||||
Rails.application.config.action_controller.raise_on_open_redirects = true
|
||||
|
||||
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
|
||||
# was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
|
||||
#
|
||||
# If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
|
||||
#
|
||||
# Continue to use `:marshal` for backward-compatibility with old cookies.
|
||||
#
|
||||
# If you have configured the serializer elsewhere, you can remove this.
|
||||
#
|
||||
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
|
||||
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
||||
|
||||
# Enable parameter wrapping for JSON.
|
||||
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
|
||||
# To disable parameter wrapping entirely, set this config to `false`.
|
||||
# Rails.application.config.action_controller.wrap_parameters_by_default = true
|
||||
|
||||
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
|
||||
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
# Globally disable auto wrapping resulting in a stricter API and to avoid bugs with array payloads.
|
||||
# See <https://github.com/forem/forem/issues/11645>
|
||||
wrap_parameters format: []
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
Loading…
Add table
Reference in a new issue