diff options
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt index 730938a1ba..438627e601 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt @@ -1,18 +1,6 @@ # Be sure to restart your server when you modify this file. # This file contains all the new default configuration options from # Rails 5.0. -<%- unless options[:skip_active_record] -%> - -# Require `belongs_to` associations by default. This is a new Rails 5.0 -# default, so it is introduced as a configuration option to ensure that apps -# made on earlier versions of Rails are not affected when upgrading. -Rails.application.config.active_record.belongs_to_required_by_default = true -<%- end -%> - -# Do not halt callback chains when a callback returns false. This is a new -# Rails 5.0 default, so it is introduced as a configuration option to ensure -# that apps made with earlier versions of Rails are not affected when upgrading. -ActiveSupport.halt_callback_chains_on_return_false = false <%- unless options[:api] -%> # Enable per-form CSRF tokens. @@ -22,16 +10,22 @@ Rails.application.config.action_controller.per_form_csrf_tokens = true Rails.application.config.action_controller.forgery_protection_origin_check = true <%- end -%> -# Configure SSL options to enable HSTS with subdomains. This is a new -# Rails 5.0 default, so it is introduced as a configuration option to ensure -# that apps made on earlier versions of Rails are not affected when upgrading. +# Following config options are introduced to ensure that apps +# made on earlier versions of Rails are not affected when upgrading. +<%- unless options[:skip_active_record] -%> + +# Require `belongs_to` associations by default. +Rails.application.config.active_record.belongs_to_required_by_default = true +<%- end -%> + +# Do not halt callback chains when a callback returns false. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Rails.application.config.ssl_options = { hsts: { subdomains: true } } # Preserve the timezone of the receiver when calling to `to_time`. # Ruby 2.4 will change the behavior of `to_time` to preserve the timezone # when converting to an instance of `Time` instead of the previous behavior # of converting to the local system timezone. -# -# Rails 5.0 introduced this config option so that apps made with earlier -# versions of Rails are not affected when upgrading. ActiveSupport.to_time_preserves_timezone = true |