Skip to content

Commit ab4e73b

Browse files
committed
Update settings for Rails 7.1: config/initializers/new_framework_defaults_7_1.rb
1 parent 5b79e80 commit ab4e73b

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

config/initializers/new_framework_defaults_7_1.rb

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@
7676
# For example, it is possible to create an index for a non existing column.
7777
# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
7878
#++
79-
# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
79+
Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
8080

8181
###
8282
# Disable deprecated singular associations names.
8383
#++
84-
# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
84+
Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
8585

8686
###
8787
# Enable the Active Job `BigDecimal` argument serializer, which guarantees
@@ -101,14 +101,14 @@
101101
# Options are `true`, and `false`. If `false`, the exception will be reported
102102
# as `handled` and logged instead.
103103
#++
104-
# Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
104+
Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
105105

106106
###
107107
# Specify whether Query Logs will format tags using the SQLCommenter format
108108
# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
109109
# Options are `:legacy` and `:sqlcommenter`.
110110
#++
111-
# Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
111+
Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
112112

113113
###
114114
# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
@@ -138,7 +138,7 @@
138138
# servers, first deploy without changing the serializer, then set the serializer
139139
# in a subsequent deploy.
140140
#++
141-
# Rails.application.config.active_support.message_serializer = :json_allow_marshal
141+
Rails.application.config.active_support.message_serializer = :json_allow_marshal
142142

143143
###
144144
# Enable a performance optimization that serializes message data and metadata
@@ -151,52 +151,59 @@
151151
# leave this optimization off on the first deploy, then enable it on a
152152
# subsequent deploy.
153153
#++
154-
# Rails.application.config.active_support.use_message_serializer_for_metadata = true
154+
Rails.application.config.active_support.use_message_serializer_for_metadata = true
155155

156156
###
157157
# Set the maximum size for Rails log files.
158158
#
159159
# `config.load_defaults 7.1` does not set this value for environments other than
160160
# development and test.
161161
#++
162-
# if Rails.env.local?
163-
# Rails.application.config.log_file_size = 100 * 1024 * 1024
164-
# end
162+
if Rails.env.local?
163+
Rails.application.config.log_file_size = 100 * 1024 * 1024
164+
end
165165

166166
###
167167
# Enable raising on assignment to attr_readonly attributes. The previous
168168
# behavior would allow assignment but silently not persist changes to the
169169
# database.
170170
#++
171-
# Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
171+
Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
172172

173173
###
174174
# Enable validating only parent-related columns for presence when the parent is mandatory.
175175
# The previous behavior was to validate the presence of the parent record, which performed an extra query
176176
# to get the parent every time the child record was updated, even when parent has not changed.
177177
#++
178-
# Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
178+
Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
179179

180180
###
181181
# Enable precompilation of `config.filter_parameters`. Precompilation can
182182
# improve filtering performance, depending on the quantity and types of filters.
183183
#++
184-
# Rails.application.config.precompile_filter_parameters = true
184+
Rails.application.config.precompile_filter_parameters = true
185+
186+
###
187+
# Enable automatic setting of inverse_of for has_many associations.
188+
# This will automatically set the inverse_of option for has_many associations
189+
# when the inverse association is defined.
190+
#++
191+
Rails.application.config.active_record.automatic_scope_inversing = true
185192

186193
###
187194
# Enable before_committed! callbacks on all enrolled records in a transaction.
188195
# The previous behavior was to only run the callbacks on the first copy of a record
189196
# if there were multiple copies of the same record enrolled in the transaction.
190197
#++
191-
# Rails.application.config.active_record.before_committed_on_all_records = true
198+
Rails.application.config.active_record.before_committed_on_all_records = true
192199

193200
###
194201
# Disable automatic column serialization into YAML.
195202
# To keep the historic behavior, you can set it to `YAML`, however it is
196203
# recommended to explicitly define the serialization method for each column
197204
# rather than to rely on a global default.
198205
#++
199-
# Rails.application.config.active_record.default_column_serializer = nil
206+
Rails.application.config.active_record.default_column_serializer = nil
200207

201208
###
202209
# Enable a performance optimization that serializes Active Record models
@@ -207,24 +214,24 @@
207214
# leave this optimization off on the first deploy, then enable it on a
208215
# subsequent deploy.
209216
#++
210-
# Rails.application.config.active_record.marshalling_format_version = 7.1
217+
Rails.application.config.active_record.marshalling_format_version = 7.1
211218

212219
###
213220
# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
214221
# This matches the behaviour of all other callbacks.
215222
# In previous versions of Rails, they ran in the inverse order.
216223
#++
217-
# Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
224+
Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
218225

219226
###
220227
# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
221228
#++
222-
# Rails.application.config.active_record.commit_transaction_on_non_local_return = true
229+
Rails.application.config.active_record.commit_transaction_on_non_local_return = true
223230

224231
###
225232
# Controls when to generate a value for <tt>has_secure_token</tt> declarations.
226233
#++
227-
# Rails.application.config.active_record.generate_secure_token_on = :initialize
234+
Rails.application.config.active_record.generate_secure_token_on = :initialize
228235

229236
###
230237
# ** Please read carefully, this must be configured in config/application.rb **
@@ -250,7 +257,7 @@
250257
#
251258
# In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
252259
#++
253-
# Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
260+
Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
254261

255262
###
256263
# Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
@@ -260,14 +267,13 @@
260267
# sanitizers if they are supported, else fall back to HTML4 sanitizers.
261268
#
262269
# In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
263-
#++
264-
# Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
270+
Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
265271

266272
###
267273
# Configure the log level used by the DebugExceptions middleware when logging
268274
# uncaught exceptions during requests.
269275
#++
270-
# Rails.application.config.action_dispatch.debug_exception_log_level = :error
276+
Rails.application.config.action_dispatch.debug_exception_log_level = :error
271277

272278
###
273279
# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
@@ -277,4 +283,4 @@
277283
#
278284
# In previous versions of Rails, these test helpers always used an HTML4 parser.
279285
#++
280-
# Rails.application.config.dom_testing_default_html_version = :html5
286+
Rails.application.config.dom_testing_default_html_version = :html5

0 commit comments

Comments
 (0)