aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt
blob: bd844f050302b2168c4d369fa56ed853146fde47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
<%- if options[:update] -%>
# Once upgraded flip defaults one by one to migrate to the new default.
#
<%- end -%>
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
<%- unless options[:api] -%>

# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = <%= options[:update] ? false : true %>

# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = <%= options[:update] ? false : true %>
<%- end -%>

# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = <%= options[:update] ? false : true %>
<%- unless options[:skip_active_record] -%>

# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = <%= options[:update] ? false : true %>
<%- end -%>
<%- unless options[:update] -%>

# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
<%- end -%>
<%- unless options[:skip_sprockets] -%>

# Unknown asset fallback will return the path passed in when the given
# asset is not present in the asset pipeline.
Rails.application.config.assets.unknown_asset_fallback = <%= options[:update] ? true : false %>
<%- end -%>