Add config.action_dispatch.cookies_default_options

Right now, cookie attributes could be set on each individual cookie by using:

cookies[:commenter_name] = { value: "david", path: "/blog/" }

We should be able to set these attributes globally in an initializer:

Rails.application.config.action_dispatch.cookies_default_options = {
  path: "/admin/",
  expires: -> { 1.day.from_now }
}

Support for Proc objects to delay execution to run time (vs initialization time).

This was particularly helpful when hosting a Rails app under a subdirectory, to avoid cookie collisions with other apps in different paths.

Here’s the PR:

https://github.com/rails/rails/pull/39827