-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuring.html
1692 lines (1580 loc) · 134 KB
/
configuring.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Configuring Rails Applications — Ruby on Rails Guides</title>
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" data-turbolinks-track="reload">
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" data-turbolinks-track="reload">
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" data-turbolinks-track="reload">
<link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" data-turbolinks-track="reload">
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<script src="javascripts/syntaxhighlighter.js" data-turbolinks-track="reload"></script>
<script src="javascripts/turbolinks.js" data-turbolinks-track="reload"></script>
<script src="javascripts/guides.js" data-turbolinks-track="reload"></script>
<script src="javascripts/responsive-tables.js" data-turbolinks-track="reload"></script>
<meta property="og:title" content="Configuring Rails Applications — Ruby on Rails Guides" />
<meta name="description" content="Configuring Rails ApplicationsThis guide covers the configuration and initialization features available to Rails applications.After reading this guide, you will know: How to adjust the behavior of your Rails applications. How to add additional code to be run at application start time." />
<meta property="og:description" content="Configuring Rails ApplicationsThis guide covers the configuration and initialization features available to Rails applications.After reading this guide, you will know: How to adjust the behavior of your Rails applications. How to add additional code to be run at application start time." />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="Ruby on Rails Guides" />
<meta property="og:image" content="https://avatars.githubusercontent.com/u/4223" />
<meta property="og:type" content="website" />
</head>
<body class="guide">
<div id="topNav">
<div class="wrapper">
<strong class="more-info-label">공식 웹사이트 <a href="https://rubyonrails.org/">rubyonrails.org:</a> </strong>
<span class="red-button more-info-button">
루비온레일스 웹사이트
</span>
<ul class="more-info-links s-hidden">
<li class="more-info"><a href="https://weblog.rubyonrails.org/">블로그</a></li>
<li class="more-info"><a href="https://guides.rubyonrails.org/">영문가이드</a></li>
<li class="more-info"><a href="https://api.rubyonrails.org/">레일스API</a></li>
<li class="more-info"><a href="https://stackoverflow.com/questions/tagged/ruby-on-rails">질문하기</a></li>
<li class="more-info"><a href="https://github.com/rails/rails">GitHub에서 기여하기</a></li>
</ul>
</div>
</div>
<div id="header">
<div class="wrapper clearfix">
<h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
<ul class="nav">
<li><a class="nav-item" href="index.html">홈</a></li>
<li class="guides-index guides-index-large">
<a href="index.html" id="guidesMenu" class="guides-index-item nav-item">가이드 인덱스</a>
<div id="guides" class="clearfix" style="display: none;">
<hr />
<div class="guides-section-container">
<div class="guides-section">
<dt>시작하면서</dt>
<dd><a href="getting_started.html">레일스로 시작하기</a></dd>
</div>
<div class="guides-section">
<dt>모델</dt>
<dd><a href="active_record_basics.html">액티브 레코드 기본</a></dd>
<dd><a href="active_record_migrations.html">액티브 레코드 마이그레이션</a></dd>
<dd><a href="active_record_validations.html">액티브 레코드 유효성 검증</a></dd>
<dd><a href="active_record_callbacks.html">액티브 레코드 콜백</a></dd>
<dd><a href="association_basics.html">Active Record Associations</a></dd>
<dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
</div>
<div class="guides-section">
<dt>Views</dt>
<dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
<dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
</div>
<div class="guides-section">
<dt>Controllers</dt>
<dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
<dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
</div>
<div class="guides-section">
<dt>Other Components</dt>
<dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
<dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
<dd><a href="active_job_basics.html">Active Job Basics</a></dd>
<dd><a href="active_storage_overview.html">Active Storage Overview</a></dd>
<dd><a href="action_cable_overview.html">Action Cable Overview</a></dd>
</div>
<div class="guides-section">
<dt>Digging Deeper</dt>
<dd><a href="i18n.html">Rails Internationalization (I18n) API</a></dd>
<dd><a href="testing.html">Testing Rails Applications</a></dd>
<dd><a href="security.html">Securing Rails Applications</a></dd>
<dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
<dd><a href="configuring.html">Configuring Rails Applications</a></dd>
<dd><a href="command_line.html">The Rails Command Line</a></dd>
<dd><a href="asset_pipeline.html">The Asset Pipeline</a></dd>
<dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd>
<dd><a href="autoloading_and_reloading_constants.html">Autoloading and Reloading Constants (Zeitwerk Mode)</a></dd>
<dd><a href="autoloading_and_reloading_constants_classic_mode.html">Autoloading and Reloading Constants (Classic Mode)</a></dd>
<dd><a href="caching_with_rails.html">Caching with Rails: An Overview</a></dd>
<dd><a href="api_app.html">Using Rails for API-only Applications</a></dd>
</div>
<div class="guides-section">
<dt>Extending Rails</dt>
<dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
<dd><a href="generators.html">Creating and Customizing Rails Generators & Templates</a></dd>
</div>
<div class="guides-section">
<dt>Contributions</dt>
<dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
<dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
<dd><a href="ruby_on_rails_guides_guidelines.html">Guides Guidelines</a></dd>
</div>
<div class="guides-section">
<dt>Policies</dt>
<dd><a href="maintenance_policy.html">Maintenance Policy</a></dd>
</div>
<div class="guides-section">
<dt>Release Notes</dt>
<dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd>
<dd><a href="6_0_release_notes.html">Version 6.0 - August 2019</a></dd>
<dd><a href="5_2_release_notes.html">Version 5.2 - April 2018</a></dd>
<dd><a href="5_1_release_notes.html">Version 5.1 - April 2017</a></dd>
<dd><a href="5_0_release_notes.html">Version 5.0 - June 2016</a></dd>
<dd><a href="4_2_release_notes.html">Version 4.2 - December 2014</a></dd>
<dd><a href="4_1_release_notes.html">Version 4.1 - April 2014</a></dd>
<dd><a href="4_0_release_notes.html">Version 4.0 - June 2013</a></dd>
<dd><a href="3_2_release_notes.html">Version 3.2 - January 2012</a></dd>
<dd><a href="3_1_release_notes.html">Version 3.1 - August 2011</a></dd>
<dd><a href="3_0_release_notes.html">Version 3.0 - August 2010</a></dd>
<dd><a href="2_3_release_notes.html">Version 2.3 - March 2009</a></dd>
<dd><a href="2_2_release_notes.html">Version 2.2 - November 2008</a></dd>
</div>
</div>
</div>
</li>
<li><a class="nav-item" href="contributing_to_ruby_on_rails.html">기여하기</a></li>
<li class="guides-index guides-index-small">
<select class="guides-index-item nav-item">
<option value="index.html">가이드 인덱스</option>
<optgroup label="시작하면서">
<option value="getting_started.html">레일스로 시작하기</option>
</optgroup>
<optgroup label="모델">
<option value="active_record_basics.html">액티브 레코드 기본</option>
<option value="active_record_migrations.html">액티브 레코드 마이그레이션</option>
<option value="active_record_validations.html">액티브 레코드 유효성 검증</option>
<option value="active_record_callbacks.html">액티브 레코드 콜백</option>
<option value="association_basics.html">Active Record Associations</option>
<option value="active_record_querying.html">Active Record Query Interface</option>
</optgroup>
<optgroup label="Views">
<option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option>
<option value="form_helpers.html">Action View Form Helpers</option>
</optgroup>
<optgroup label="Controllers">
<option value="action_controller_overview.html">Action Controller Overview</option>
<option value="routing.html">Rails Routing from the Outside In</option>
</optgroup>
<optgroup label="Other Components">
<option value="active_support_core_extensions.html">Active Support Core Extensions</option>
<option value="action_mailer_basics.html">Action Mailer Basics</option>
<option value="active_job_basics.html">Active Job Basics</option>
<option value="active_storage_overview.html">Active Storage Overview</option>
<option value="action_cable_overview.html">Action Cable Overview</option>
</optgroup>
<optgroup label="Digging Deeper">
<option value="i18n.html">Rails Internationalization (I18n) API</option>
<option value="testing.html">Testing Rails Applications</option>
<option value="security.html">Securing Rails Applications</option>
<option value="debugging_rails_applications.html">Debugging Rails Applications</option>
<option value="configuring.html">Configuring Rails Applications</option>
<option value="command_line.html">The Rails Command Line</option>
<option value="asset_pipeline.html">The Asset Pipeline</option>
<option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option>
<option value="autoloading_and_reloading_constants.html">Autoloading and Reloading Constants (Zeitwerk Mode)</option>
<option value="autoloading_and_reloading_constants_classic_mode.html">Autoloading and Reloading Constants (Classic Mode)</option>
<option value="caching_with_rails.html">Caching with Rails: An Overview</option>
<option value="api_app.html">Using Rails for API-only Applications</option>
</optgroup>
<optgroup label="Extending Rails">
<option value="rails_on_rack.html">Rails on Rack</option>
<option value="generators.html">Creating and Customizing Rails Generators & Templates</option>
</optgroup>
<optgroup label="Contributions">
<option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option>
<option value="api_documentation_guidelines.html">API Documentation Guidelines</option>
<option value="ruby_on_rails_guides_guidelines.html">Guides Guidelines</option>
</optgroup>
<optgroup label="Policies">
<option value="maintenance_policy.html">Maintenance Policy</option>
</optgroup>
<optgroup label="Release Notes">
<option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option>
<option value="6_0_release_notes.html">Version 6.0 - August 2019</option>
<option value="5_2_release_notes.html">Version 5.2 - April 2018</option>
<option value="5_1_release_notes.html">Version 5.1 - April 2017</option>
<option value="5_0_release_notes.html">Version 5.0 - June 2016</option>
<option value="4_2_release_notes.html">Version 4.2 - December 2014</option>
<option value="4_1_release_notes.html">Version 4.1 - April 2014</option>
<option value="4_0_release_notes.html">Version 4.0 - June 2013</option>
<option value="3_2_release_notes.html">Version 3.2 - January 2012</option>
<option value="3_1_release_notes.html">Version 3.1 - August 2011</option>
<option value="3_0_release_notes.html">Version 3.0 - August 2010</option>
<option value="2_3_release_notes.html">Version 2.3 - March 2009</option>
<option value="2_2_release_notes.html">Version 2.2 - November 2008</option>
</optgroup>
</select>
</li>
</ul>
</div>
</div>
<hr class="hide" />
<div id="feature">
<div class="wrapper">
<h2>Configuring Rails Applications</h2><p>This guide covers the configuration and initialization features available to Rails applications.</p><p>After reading this guide, you will know:</p>
<ul>
<li>How to adjust the behavior of your Rails applications.</li>
<li>How to add additional code to be run at application start time.</li>
</ul>
<div id="subCol">
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
<ol class="chapters">
<li><a href="#locations-for-initialization-code">Locations for Initialization Code</a></li>
<li><a href="#running-code-before-rails">Running Code Before Rails</a></li>
<li>
<a href="#configuring-rails-components">Configuring Rails Components</a>
<ul>
<li><a href="#rails-general-configuration">Rails General Configuration</a></li>
<li><a href="#configuring-assets">Configuring Assets</a></li>
<li><a href="#configuring-generators">Configuring Generators</a></li>
<li><a href="#configuring-middleware">Configuring Middleware</a></li>
<li><a href="#configuring-i18n">Configuring i18n</a></li>
<li><a href="#configuring-active-model">Configuring Active Model</a></li>
<li><a href="#configuring-active-record">Configuring Active Record</a></li>
<li><a href="#configuring-action-controller">Configuring Action Controller</a></li>
<li><a href="#configuring-action-dispatch">Configuring Action Dispatch</a></li>
<li><a href="#configuring-action-view">Configuring Action View</a></li>
<li><a href="#configuring-action-mailbox">Configuring Action Mailbox</a></li>
<li><a href="#configuring-action-mailer">Configuring Action Mailer</a></li>
<li><a href="#configuring-active-support">Configuring Active Support</a></li>
<li><a href="#configuring-active-job">Configuring Active Job</a></li>
<li><a href="#configuring-action-cable">Configuring Action Cable</a></li>
<li><a href="#configuring-active-storage">Configuring Active Storage</a></li>
<li><a href="#results-of-load-defaults">Results of <code>load_defaults</code></a></li>
<li><a href="#configuring-a-database">Configuring a Database</a></li>
<li><a href="#connection-preference">Connection Preference</a></li>
<li><a href="#creating-rails-environments">Creating Rails Environments</a></li>
<li><a href="#deploy-to-a-subdirectory-relative-url-root">Deploy to a subdirectory (relative URL root)</a></li>
</ul>
</li>
<li><a href="#rails-environment-settings">Rails Environment Settings</a></li>
<li><a href="#using-initializer-files">Using Initializer Files</a></li>
<li>
<a href="#initialization-events">Initialization events</a>
<ul>
<li><a href="#rails-railtie-initializer"><code>Rails::Railtie#initializer</code></a></li>
<li><a href="#initializers">Initializers</a></li>
</ul>
</li>
<li><a href="#database-pooling">Database pooling</a></li>
<li><a href="#custom-configuration">Custom configuration</a></li>
<li><a href="#search-engines-indexing">Search Engines Indexing</a></li>
<li><a href="#evented-file-system-monitor">Evented File System Monitor</a></li>
</ol>
</div>
</div>
</div>
<div id="container">
<div class="wrapper">
<div id="mainCol">
<h3 id="locations-for-initialization-code"><a class="anchorlink" href="#locations-for-initialization-code">1 Locations for Initialization Code</a></h3><p>Rails offers four standard spots to place initialization code:</p>
<ul>
<li><code>config/application.rb</code></li>
<li>Environment-specific configuration files</li>
<li>Initializers</li>
<li>After-initializers</li>
</ul>
<h3 id="running-code-before-rails"><a class="anchorlink" href="#running-code-before-rails">2 Running Code Before Rails</a></h3><p>In the rare event that your application needs to run some code before Rails itself is loaded, put it above the call to <code>require 'rails/all'</code> in <code>config/application.rb</code>.</p><h3 id="configuring-rails-components"><a class="anchorlink" href="#configuring-rails-components">3 Configuring Rails Components</a></h3><p>In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The configuration file <code>config/application.rb</code> and environment-specific configuration files (such as <code>config/environments/production.rb</code>) allow you to specify the various settings that you want to pass down to all of the components.</p><p>For example, you could add this setting to <code>config/application.rb</code> file:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.time_zone = 'Central Time (US & Canada)'
</pre>
</div>
<p>This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same <code>config</code> object in <code>config/application.rb</code>:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.active_record.schema_format = :ruby
</pre>
</div>
<p>Rails will use that particular setting to configure Active Record.</p><h4 id="rails-general-configuration"><a class="anchorlink" href="#rails-general-configuration">3.1 Rails General Configuration</a></h4><p>These configuration methods are to be called on a <code>Rails::Railtie</code> object, such as a subclass of <code>Rails::Engine</code> or <code>Rails::Application</code>.</p>
<ul>
<li>
<p><code>config.after_initialize</code> takes a block which will be run <em>after</em> Rails has finished initializing the application. That includes the initialization of the framework itself, engines, and all the application's initializers in <code>config/initializers</code>. Note that this block <em>will</em> be run for rake tasks. Useful for configuring values set up by other initializers:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.after_initialize do
ActionView::Base.sanitized_allowed_tags.delete 'div'
end
</pre>
</div>
</li>
<li><p><code>config.asset_host</code> sets the host for the assets. Useful when CDNs are used for hosting assets, or when you want to work around the concurrency constraints built-in in browsers using different domain aliases. Shorter version of <code>config.action_controller.asset_host</code>.</p></li>
<li><p><code>config.autoload_once_paths</code> accepts an array of paths from which Rails will autoload constants that won't be wiped per request. Relevant if <code>config.cache_classes</code> is <code>false</code>, which is the case in development mode by default. Otherwise, all autoloading happens only once. All elements of this array must also be in <code>autoload_paths</code>. Default is an empty array.</p></li>
<li><p><code>config.autoload_paths</code> accepts an array of paths from which Rails will autoload constants. Default is all directories under <code>app</code>. It is no longer recommended to adjust this. See <a href="autoloading_and_reloading_constants.html#autoload-paths-and-eager-load-paths">Autoloading and Reloading Constants</a></p></li>
<li><p><code>config.add_autoload_paths_to_load_path</code> says whether autoload paths have to be added to <code>$LOAD_PATH</code>. This flag is <code>true</code> by default, but it is recommended to be set to <code>false</code> in <code>:zeitwerk</code> mode early, in <code>config/application.rb</code>. Zeitwerk uses absolute paths internally, and applications running in <code>:zeitwerk</code> mode do not need <code>require_dependency</code>, so models, controllers, jobs, etc. do not need to be in <code>$LOAD_PATH</code>. Setting this to <code>false</code> saves Ruby from checking these directories when resolving <code>require</code> calls with relative paths, and saves Bootsnap work and RAM, since it does not need to build an index for them.</p></li>
<li><p><code>config.cache_classes</code> controls whether or not application classes and modules should be reloaded if they change. Defaults to <code>false</code> in development mode, and <code>true</code> in production mode. In <code>test</code> mode, the default is <code>false</code> if Spring is installed, <code>true</code> otherwise.</p></li>
<li><p><code>config.beginning_of_week</code> sets the default beginning of week for the
application. Accepts a valid week day symbol (e.g. <code>:monday</code>).</p></li>
<li><p><code>config.cache_store</code> configures which cache store to use for Rails caching. Options include one of the symbols <code>:memory_store</code>, <code>:file_store</code>, <code>:mem_cache_store</code>, <code>:null_store</code>, <code>:redis_cache_store</code>, or an object that implements the cache API. Defaults to <code>:file_store</code>.</p></li>
<li><p><code>config.colorize_logging</code> specifies whether or not to use ANSI color codes when logging information. Defaults to <code>true</code>.</p></li>
<li><p><code>config.consider_all_requests_local</code> is a flag. If <code>true</code> then any error will cause detailed debugging information to be dumped in the HTTP response, and the <code>Rails::Info</code> controller will show the application runtime context in <code>/rails/info/properties</code>. <code>true</code> by default in development and test environments, and <code>false</code> in production mode. For finer-grained control, set this to <code>false</code> and implement <code>local_request?</code> in controllers to specify which requests should provide debugging information on errors.</p></li>
<li>
<p><code>config.console</code> allows you to set class that will be used as console you run <code>rails console</code>. It's best to run it in <code>console</code> block:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
console do
# this block is called only when running console,
# so we can safely require pry here
require "pry"
config.console = Pry
end
</pre>
</div>
</li>
<li><p><code>config.disable_sandbox</code> controls whether or not someone can start a console in sandbox mode. This is helpful to avoid a long running session of sandbox console, that could lead a database server to run out of memory. Defaults to false.</p></li>
<li><p><code>config.eager_load</code> when <code>true</code>, eager loads all registered <code>config.eager_load_namespaces</code>. This includes your application, engines, Rails frameworks, and any other registered namespace.</p></li>
<li><p><code>config.eager_load_namespaces</code> registers namespaces that are eager loaded when <code>config.eager_load</code> is <code>true</code>. All namespaces in the list must respond to the <code>eager_load!</code> method.</p></li>
<li><p><code>config.eager_load_paths</code> accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the <code>app</code> directory of the application.</p></li>
<li><p><code>config.enable_dependency_loading</code>: when true, enables autoloading, even if the application is eager loaded and <code>config.cache_classes</code> is set as true. Defaults to false.</p></li>
<li><p><code>config.encoding</code> sets up the application-wide encoding. Defaults to UTF-8.</p></li>
<li><p><code>config.exceptions_app</code> sets the exceptions application invoked by the ShowException middleware when an exception happens. Defaults to <code>ActionDispatch::PublicExceptions.new(Rails.public_path)</code>.</p></li>
<li><p><code>config.debug_exception_response_format</code> sets the format used in responses when errors occur in development mode. Defaults to <code>:api</code> for API only apps and <code>:default</code> for normal apps.</p></li>
<li><p><code>config.file_watcher</code> is the class used to detect file updates in the file system when <code>config.reload_classes_only_on_change</code> is <code>true</code>. Rails ships with <code>ActiveSupport::FileUpdateChecker</code>, the default, and <code>ActiveSupport::EventedFileUpdateChecker</code> (this one depends on the <a href="https://github.com/guard/listen">listen</a> gem). Custom classes must conform to the <code>ActiveSupport::FileUpdateChecker</code> API.</p></li>
<li><p><code>config.filter_parameters</code> used for filtering out the parameters that
you don't want shown in the logs, such as passwords or credit card
numbers. It also filters out sensitive values of database columns when call <code>#inspect</code> on an Active Record object. By default, Rails filters out passwords by adding <code>Rails.application.config.filter_parameters += [:password]</code> in <code>config/initializers/filter_parameter_logging.rb</code>. Parameters filter works by partial matching regular expression.</p></li>
<li><p><code>config.force_ssl</code> forces all requests to be served over HTTPS by using the <code>ActionDispatch::SSL</code> middleware, and sets <code>config.action_mailer.default_url_options</code> to be <code>{ protocol: 'https' }</code>. This can be configured by setting <code>config.ssl_options</code> - see the <a href="https://api.rubyonrails.org/6-0-stable/classes/ActionDispatch/SSL.html">ActionDispatch::SSL documentation</a> for details.</p></li>
<li><p><code>config.log_formatter</code> defines the formatter of the Rails logger. This option defaults to an instance of <code>ActiveSupport::Logger::SimpleFormatter</code> for all modes. If you are setting a value for <code>config.logger</code> you must manually pass the value of your formatter to your logger before it is wrapped in an <code>ActiveSupport::TaggedLogging</code> instance, Rails will not do it for you.</p></li>
<li><p><code>config.log_level</code> defines the verbosity of the Rails logger. This option
defaults to <code>:debug</code> for all environments. The available log levels are: <code>:debug</code>,
<code>:info</code>, <code>:warn</code>, <code>:error</code>, <code>:fatal</code>, and <code>:unknown</code>.</p></li>
<li><p><code>config.log_tags</code> accepts a list of: methods that the <code>request</code> object responds to, a <code>Proc</code> that accepts the <code>request</code> object, or something that responds to <code>to_s</code>. This makes it easy to tag log lines with debug information like subdomain and request id - both very helpful in debugging multi-user production applications.</p></li>
<li>
<p><code>config.logger</code> is the logger that will be used for <code>Rails.logger</code> and any related Rails logging such as <code>ActiveRecord::Base.logger</code>. It defaults to an instance of <code>ActiveSupport::TaggedLogging</code> that wraps an instance of <code>ActiveSupport::Logger</code> which outputs a log to the <code>log/</code> directory. You can supply a custom logger, to get full compatibility you must follow these guidelines:</p>
<ul>
<li>To support a formatter, you must manually assign a formatter from the <code>config.log_formatter</code> value to the logger.</li>
<li>To support tagged logs, the log instance must be wrapped with <code>ActiveSupport::TaggedLogging</code>.</li>
<li>To support silencing, the logger must include <code>ActiveSupport::LoggerSilence</code> module. The <code>ActiveSupport::Logger</code> class already includes these modules.</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
class MyLogger < ::Logger
include ActiveSupport::LoggerSilence
end
mylogger = MyLogger.new(STDOUT)
mylogger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(mylogger)
</pre>
</div>
</li>
<li><p><code>config.middleware</code> allows you to configure the application's middleware. This is covered in depth in the <a href="#configuring-middleware">Configuring Middleware</a> section below.</p></li>
<li><p><code>config.reload_classes_only_on_change</code> enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to <code>true</code>. If <code>config.cache_classes</code> is <code>true</code>, this option is ignored.</p></li>
<li><p><code>config.credentials.content_path</code> configures lookup path for encrypted credentials.</p></li>
<li><p><code>config.credentials.key_path</code> configures lookup path for encryption key.</p></li>
<li><p><code>secret_key_base</code> is used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get a random generated key in test and development environments, other environments should set one in <code>config/credentials.yml.enc</code>.</p></li>
<li><p><code>config.public_file_server.enabled</code> configures Rails to serve static files from the public directory. This option defaults to <code>true</code>, but in the production environment it is set to <code>false</code> because the server software (e.g. NGINX or Apache) used to run the application should serve static files instead. If you are running or testing your app in production mode using WEBrick (it is not recommended to use WEBrick in production) set the option to <code>true</code>. Otherwise, you won't be able to use page caching and request for files that exist under the public directory.</p></li>
<li>
<p><code>config.session_store</code> specifies what class to use to store the session. Possible values are <code>:cookie_store</code> which is the default, <code>:mem_cache_store</code>, and <code>:disabled</code>. The last one tells Rails not to deal with sessions. Defaults to a cookie store with application name as the session key. Custom session stores can also be specified:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.session_store :my_custom_store
</pre>
</div>
<p>This custom store must be defined as <code>ActionDispatch::Session::MyCustomStore</code>.</p>
</li>
<li><p><code>config.time_zone</code> sets the default time zone for the application and enables time zone awareness for Active Record.</p></li>
<li>
<p><code>config.autoloader</code> sets the autoloading mode. This option defaults to <code>:zeitwerk</code> if <code>6.0</code> is specified in <code>config.load_defaults</code>. Applications can still use the classic autoloader by setting this value to <code>:classic</code> after loading the framework defaults:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.load_defaults "6.0"
config.autoloader = :classic
</pre>
</div>
</li>
</ul>
<h4 id="configuring-assets"><a class="anchorlink" href="#configuring-assets">3.2 Configuring Assets</a></h4>
<ul>
<li><p><code>config.assets.enabled</code> a flag that controls whether the asset
pipeline is enabled. It is set to <code>true</code> by default.</p></li>
<li><p><code>config.assets.css_compressor</code> defines the CSS compressor to use. It is set by default by <code>sass-rails</code>. The unique alternative value at the moment is <code>:yui</code>, which uses the <code>yui-compressor</code> gem.</p></li>
<li><p><code>config.assets.js_compressor</code> defines the JavaScript compressor to use. Possible values are <code>:closure</code>, <code>:uglifier</code> and <code>:yui</code> which require the use of the <code>closure-compiler</code>, <code>uglifier</code> or <code>yui-compressor</code> gems respectively.</p></li>
<li><p><code>config.assets.gzip</code> a flag that enables the creation of gzipped version of compiled assets, along with non-gzipped assets. Set to <code>true</code> by default.</p></li>
<li><p><code>config.assets.paths</code> contains the paths which are used to look for assets. Appending paths to this configuration option will cause those paths to be used in the search for assets.</p></li>
<li><p><code>config.assets.precompile</code> allows you to specify additional assets (other than <code>application.css</code> and <code>application.js</code>) which are to be precompiled when <code>rake assets:precompile</code> is run.</p></li>
<li><p><code>config.assets.unknown_asset_fallback</code> allows you to modify the behavior of the asset pipeline when an asset is not in the pipeline, if you use sprockets-rails 3.2.0 or newer. Defaults to <code>false</code>.</p></li>
<li><p><code>config.assets.prefix</code> defines the prefix where assets are served from. Defaults to <code>/assets</code>.</p></li>
<li><p><code>config.assets.manifest</code> defines the full path to be used for the asset precompiler's manifest file. Defaults to a file named <code>manifest-<random>.json</code> in the <code>config.assets.prefix</code> directory within the public folder.</p></li>
<li><p><code>config.assets.digest</code> enables the use of SHA256 fingerprints in asset names. Set to <code>true</code> by default.</p></li>
<li><p><code>config.assets.debug</code> disables the concatenation and compression of assets. Set to <code>true</code> by default in <code>development.rb</code>.</p></li>
<li><p><code>config.assets.version</code> is an option string that is used in SHA256 hash generation. This can be changed to force all files to be recompiled.</p></li>
<li><p><code>config.assets.compile</code> is a boolean that can be used to turn on live Sprockets compilation in production.</p></li>
<li><p><code>config.assets.logger</code> accepts a logger conforming to the interface of Log4r or the default Ruby <code>Logger</code> class. Defaults to the same configured at <code>config.logger</code>. Setting <code>config.assets.logger</code> to <code>false</code> will turn off served assets logging.</p></li>
<li><p><code>config.assets.quiet</code> disables logging of assets requests. Set to <code>true</code> by default in <code>development.rb</code>.</p></li>
</ul>
<h4 id="configuring-generators"><a class="anchorlink" href="#configuring-generators">3.3 Configuring Generators</a></h4><p>Rails allows you to alter what generators are used with the <code>config.generators</code> method. This method takes a block:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.generators do |g|
g.orm :active_record
g.test_framework :test_unit
end
</pre>
</div>
<p>The full set of methods that can be used in this block are as follows:</p>
<ul>
<li>
<code>assets</code> allows to create assets on generating a scaffold. Defaults to <code>true</code>.</li>
<li>
<code>force_plural</code> allows pluralized model names. Defaults to <code>false</code>.</li>
<li>
<code>helper</code> defines whether or not to generate helpers. Defaults to <code>true</code>.</li>
<li>
<code>integration_tool</code> defines which integration tool to use to generate integration tests. Defaults to <code>:test_unit</code>.</li>
<li>
<code>system_tests</code> defines which integration tool to use to generate system tests. Defaults to <code>:test_unit</code>.</li>
<li>
<code>orm</code> defines which orm to use. Defaults to <code>false</code> and will use Active Record by default.</li>
<li>
<code>resource_controller</code> defines which generator to use for generating a controller when using <code>rails generate resource</code>. Defaults to <code>:controller</code>.</li>
<li>
<code>resource_route</code> defines whether a resource route definition should be generated
or not. Defaults to <code>true</code>.</li>
<li>
<code>scaffold_controller</code> different from <code>resource_controller</code>, defines which generator to use for generating a <em>scaffolded</em> controller when using <code>rails generate scaffold</code>. Defaults to <code>:scaffold_controller</code>.</li>
<li>
<code>stylesheets</code> turns on the hook for stylesheets in generators. Used in Rails for when the <code>scaffold</code> generator is run, but this hook can be used in other generates as well. Defaults to <code>true</code>.</li>
<li>
<code>stylesheet_engine</code> configures the stylesheet engine (for eg. sass) to be used when generating assets. Defaults to <code>:css</code>.</li>
<li>
<code>scaffold_stylesheet</code> creates <code>scaffold.css</code> when generating a scaffolded resource. Defaults to <code>true</code>.</li>
<li>
<code>test_framework</code> defines which test framework to use. Defaults to <code>false</code> and will use minitest by default.</li>
<li>
<code>template_engine</code> defines which template engine to use, such as ERB or Haml. Defaults to <code>:erb</code>.</li>
</ul>
<h4 id="configuring-middleware"><a class="anchorlink" href="#configuring-middleware">3.4 Configuring Middleware</a></h4><p>Every Rails application comes with a standard set of middleware which it uses in this order in the development environment:</p>
<ul>
<li>
<code>ActionDispatch::SSL</code> forces every request to be served using HTTPS. Enabled if <code>config.force_ssl</code> is set to <code>true</code>. Options passed to this can be configured by setting <code>config.ssl_options</code>.</li>
<li>
<code>ActionDispatch::Static</code> is used to serve static assets. Disabled if <code>config.public_file_server.enabled</code> is <code>false</code>. Set <code>config.public_file_server.index_name</code> if you need to serve a static directory index file that is not named <code>index</code>. For example, to serve <code>main.html</code> instead of <code>index.html</code> for directory requests, set <code>config.public_file_server.index_name</code> to <code>"main"</code>.</li>
<li>
<code>ActionDispatch::Executor</code> allows thread safe code reloading. Disabled if <code>config.allow_concurrency</code> is <code>false</code>, which causes <code>Rack::Lock</code> to be loaded. <code>Rack::Lock</code> wraps the app in mutex so it can only be called by a single thread at a time.</li>
<li>
<code>ActiveSupport::Cache::Strategy::LocalCache</code> serves as a basic memory backed cache. This cache is not thread safe and is intended only for serving as a temporary memory cache for a single thread.</li>
<li>
<code>Rack::Runtime</code> sets an <code>X-Runtime</code> header, containing the time (in seconds) taken to execute the request.</li>
<li>
<code>Rails::Rack::Logger</code> notifies the logs that the request has begun. After request is complete, flushes all the logs.</li>
<li>
<code>ActionDispatch::ShowExceptions</code> rescues any exception returned by the application and renders nice exception pages if the request is local or if <code>config.consider_all_requests_local</code> is set to <code>true</code>. If <code>config.action_dispatch.show_exceptions</code> is set to <code>false</code>, exceptions will be raised regardless.</li>
<li>
<code>ActionDispatch::RequestId</code> makes a unique X-Request-Id header available to the response and enables the <code>ActionDispatch::Request#uuid</code> method.</li>
<li>
<code>ActionDispatch::RemoteIp</code> checks for IP spoofing attacks and gets valid <code>client_ip</code> from request headers. Configurable with the <code>config.action_dispatch.ip_spoofing_check</code>, and <code>config.action_dispatch.trusted_proxies</code> options.</li>
<li>
<code>Rack::Sendfile</code> intercepts responses whose body is being served from a file and replaces it with a server specific X-Sendfile header. Configurable with <code>config.action_dispatch.x_sendfile_header</code>.</li>
<li>
<code>ActionDispatch::Callbacks</code> runs the prepare callbacks before serving the request.</li>
<li>
<code>ActionDispatch::Cookies</code> sets cookies for the request.</li>
<li>
<code>ActionDispatch::Session::CookieStore</code> is responsible for storing the session in cookies. An alternate middleware can be used for this by changing the <code>config.action_controller.session_store</code> to an alternate value. Additionally, options passed to this can be configured by using <code>config.action_controller.session_options</code>.</li>
<li>
<code>ActionDispatch::Flash</code> sets up the <code>flash</code> keys. Only available if <code>config.action_controller.session_store</code> is set to a value.</li>
<li>
<code>Rack::MethodOverride</code> allows the method to be overridden if <code>params[:_method]</code> is set. This is the middleware which supports the PATCH, PUT, and DELETE HTTP method types.</li>
<li>
<code>Rack::Head</code> converts HEAD requests to GET requests and serves them as so.</li>
</ul>
<p>Besides these usual middleware, you can add your own by using the <code>config.middleware.use</code> method:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.use Magical::Unicorns
</pre>
</div>
<p>This will put the <code>Magical::Unicorns</code> middleware on the end of the stack. You can use <code>insert_before</code> if you wish to add a middleware before another.</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.insert_before Rack::Head, Magical::Unicorns
</pre>
</div>
<p>Or you can insert a middleware to exact position by using indexes. For example, if you want to insert <code>Magical::Unicorns</code> middleware on top of the stack, you can do it, like so:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.insert_before 0, Magical::Unicorns
</pre>
</div>
<p>There's also <code>insert_after</code> which will insert a middleware after another:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.insert_after Rack::Head, Magical::Unicorns
</pre>
</div>
<p>Middlewares can also be completely swapped out and replaced with others:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.swap ActionController::Failsafe, Lifo::Failsafe
</pre>
</div>
<p>They can also be removed from the stack completely:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.middleware.delete Rack::MethodOverride
</pre>
</div>
<h4 id="configuring-i18n"><a class="anchorlink" href="#configuring-i18n">3.5 Configuring i18n</a></h4><p>All these configuration options are delegated to the <code>I18n</code> library.</p>
<ul>
<li><p><code>config.i18n.available_locales</code> defines the permitted available locales for the app. Defaults to all locale keys found in locale files, usually only <code>:en</code> on a new application.</p></li>
<li><p><code>config.i18n.default_locale</code> sets the default locale of an application used for i18n. Defaults to <code>:en</code>.</p></li>
<li><p><code>config.i18n.enforce_available_locales</code> ensures that all locales passed through i18n must be declared in the <code>available_locales</code> list, raising an <code>I18n::InvalidLocale</code> exception when setting an unavailable locale. Defaults to <code>true</code>. It is recommended not to disable this option unless strongly required, since this works as a security measure against setting any invalid locale from user input.</p></li>
<li><p><code>config.i18n.load_path</code> sets the path Rails uses to look for locale files. Defaults to <code>config/locales/*.{yml,rb}</code>.</p></li>
<li>
<p><code>config.i18n.fallbacks</code> sets fallback behavior for missing translations. Here are 3 usage examples for this option:</p>
<ul>
<li>You can set the option to <code>true</code> for using default locale as fallback, like so:</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.i18n.fallbacks = true
</pre>
</div>
<ul>
<li>Or you can set an array of locales as fallback, like so:</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.i18n.fallbacks = [:tr, :en]
</pre>
</div>
<ul>
<li>Or you can set different fallbacks for locales individually. For example, if you want to use <code>:tr</code> for <code>:az</code> and <code>:de</code>, <code>:en</code> for <code>:da</code> as fallbacks, you can do it, like so:</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.i18n.fallbacks = { az: :tr, da: [:de, :en] }
#or
config.i18n.fallbacks.map = { az: :tr, da: [:de, :en] }
</pre>
</div>
</li>
</ul>
<h4 id="configuring-active-model"><a class="anchorlink" href="#configuring-active-model">3.6 Configuring Active Model</a></h4>
<ul>
<li>
<code>config.active_model.i18n_customize_full_message</code> is a boolean value which controls whether the <code>full_message</code> error format can be overridden at the attribute or model level in the locale files. This is <code>false</code> by default.</li>
</ul>
<h4 id="configuring-active-record"><a class="anchorlink" href="#configuring-active-record">3.7 Configuring Active Record</a></h4><p><code>config.active_record</code> includes a variety of configuration options:</p>
<ul>
<li><p><code>config.active_record.logger</code> accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then passed on to any new database connections made. You can retrieve this logger by calling <code>logger</code> on either an Active Record model class or an Active Record model instance. Set to <code>nil</code> to disable logging.</p></li>
<li>
<p><code>config.active_record.primary_key_prefix_type</code> lets you adjust the naming for primary key columns. By default, Rails assumes that primary key columns are named <code>id</code> (and this configuration option doesn't need to be set.) There are two other choices:</p>
<ul>
<li>
<code>:table_name</code> would make the primary key for the Customer class <code>customerid</code>.</li>
<li>
<code>:table_name_with_underscore</code> would make the primary key for the Customer class <code>customer_id</code>.</li>
</ul>
</li>
<li><p><code>config.active_record.table_name_prefix</code> lets you set a global string to be prepended to table names. If you set this to <code>northwest_</code>, then the Customer class will look for <code>northwest_customers</code> as its table. The default is an empty string.</p></li>
<li><p><code>config.active_record.table_name_suffix</code> lets you set a global string to be appended to table names. If you set this to <code>_northwest</code>, then the Customer class will look for <code>customers_northwest</code> as its table. The default is an empty string.</p></li>
<li><p><code>config.active_record.schema_migrations_table_name</code> lets you set a string to be used as the name of the schema migrations table.</p></li>
<li><p><code>config.active_record.internal_metadata_table_name</code> lets you set a string to be used as the name of the internal metadata table.</p></li>
<li><p><code>config.active_record.protected_environments</code> lets you set an array of names of environments where destructive actions should be prohibited.</p></li>
<li><p><code>config.active_record.pluralize_table_names</code> specifies whether Rails will look for singular or plural table names in the database. If set to <code>true</code> (the default), then the Customer class will use the <code>customers</code> table. If set to false, then the Customer class will use the <code>customer</code> table.</p></li>
<li><p><code>config.active_record.default_timezone</code> determines whether to use <code>Time.local</code> (if set to <code>:local</code>) or <code>Time.utc</code> (if set to <code>:utc</code>) when pulling dates and times from the database. The default is <code>:utc</code>.</p></li>
<li><p><code>config.active_record.schema_format</code> controls the format for dumping the database schema to a file. The options are <code>:ruby</code> (the default) for a database-independent version that depends on migrations, or <code>:sql</code> for a set of (potentially database-dependent) SQL statements.</p></li>
<li><p><code>config.active_record.error_on_ignored_order</code> specifies if an error should be raised if the order of a query is ignored during a batch query. The options are <code>true</code> (raise error) or <code>false</code> (warn). Default is <code>false</code>.</p></li>
<li><p><code>config.active_record.timestamped_migrations</code> controls whether migrations are numbered with serial integers or with timestamps. The default is <code>true</code>, to use timestamps, which are preferred if there are multiple developers working on the same application.</p></li>
<li><p><code>config.active_record.lock_optimistically</code> controls whether Active Record will use optimistic locking and is <code>true</code> by default.</p></li>
<li><p><code>config.active_record.cache_timestamp_format</code> controls the format of the timestamp value in the cache key. Default is <code>:usec</code>.</p></li>
<li><p><code>config.active_record.record_timestamps</code> is a boolean value which controls whether or not timestamping of <code>create</code> and <code>update</code> operations on a model occur. The default value is <code>true</code>.</p></li>
<li><p><code>config.active_record.partial_writes</code> is a boolean value and controls whether or not partial writes are used (i.e. whether updates only set attributes that are dirty). Note that when using partial writes, you should also use optimistic locking <code>config.active_record.lock_optimistically</code> since concurrent updates may write attributes based on a possibly stale read state. The default value is <code>true</code>.</p></li>
<li><p><code>config.active_record.maintain_test_schema</code> is a boolean value which controls whether Active Record should try to keep your test database schema up-to-date with <code>db/schema.rb</code> (or <code>db/structure.sql</code>) when you run your tests. The default is <code>true</code>.</p></li>
<li><p><code>config.active_record.dump_schema_after_migration</code> is a flag which
controls whether or not schema dump should happen (<code>db/schema.rb</code> or
<code>db/structure.sql</code>) when you run migrations. This is set to <code>false</code> in
<code>config/environments/production.rb</code> which is generated by Rails. The
default value is <code>true</code> if this configuration is not set.</p></li>
<li><p><code>config.active_record.dump_schemas</code> controls which database schemas will be dumped when calling <code>db:structure:dump</code>.
The options are <code>:schema_search_path</code> (the default) which dumps any schemas listed in <code>schema_search_path</code>,
<code>:all</code> which always dumps all schemas regardless of the <code>schema_search_path</code>,
or a string of comma separated schemas.</p></li>
<li><p><code>config.active_record.belongs_to_required_by_default</code> is a boolean value and
controls whether a record fails validation if <code>belongs_to</code> association is not
present.</p></li>
<li><p><code>config.active_record.warn_on_records_fetched_greater_than</code> allows setting a
warning threshold for query result size. If the number of records returned
by a query exceeds the threshold, a warning is logged. This can be used to
identify queries which might be causing a memory bloat.</p></li>
<li><p><code>config.active_record.index_nested_attribute_errors</code> allows errors for nested
<code>has_many</code> relationships to be displayed with an index as well as the error.
Defaults to <code>false</code>.</p></li>
<li><p><code>config.active_record.use_schema_cache_dump</code> enables users to get schema cache information
from <code>db/schema_cache.yml</code> (generated by <code>rails db:schema:cache:dump</code>), instead of
having to send a query to the database to get this information.
Defaults to <code>true</code>.</p></li>
<li><p><code>config.active_record.collection_cache_versioning</code> enables the same cache key
to be reused when the object being cached of type <code>ActiveRecord::Relation</code>
changes by moving the volatile information (max updated at and count) of
the relation's cache key into the cache version to support recycling cache key.
Defaults to <code>false</code>.</p></li>
</ul>
<p>The MySQL adapter adds one additional configuration option:</p>
<ul>
<li>
<code>ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans</code> controls whether Active Record will consider all <code>tinyint(1)</code> columns as booleans. Defaults to <code>true</code>.</li>
</ul>
<p>The PostgreSQL adapter adds one additional configuration option:</p>
<ul>
<li>
<code>ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables</code>
controls whether database tables created should be "unlogged," which can speed
up performance but adds a risk of data loss if the database crashes. It is
highly recommended that you do not enable this in a production environment.
Defaults to <code>false</code> in all environments.</li>
</ul>
<p>The schema dumper adds two additional configuration options:</p>
<ul>
<li><p><code>ActiveRecord::SchemaDumper.ignore_tables</code> accepts an array of tables that should <em>not</em> be included in any generated schema file.</p></li>
<li><p><code>ActiveRecord::SchemaDumper.fk_ignore_pattern</code> allows setting a different regular
expression that will be used to decide whether a foreign key's name should be
dumped to db/schema.rb or not. By default, foreign key names starting with
<code>fk_rails_</code> are not exported to the database schema dump.
Defaults to <code>/^fk_rails_[0-9a-f]{10}$/</code>.</p></li>
</ul>
<h4 id="configuring-action-controller"><a class="anchorlink" href="#configuring-action-controller">3.8 Configuring Action Controller</a></h4><p><code>config.action_controller</code> includes a number of configuration settings:</p>
<ul>
<li><p><code>config.action_controller.asset_host</code> sets the host for the assets. Useful when CDNs are used for hosting assets rather than the application server itself.</p></li>
<li><p><code>config.action_controller.perform_caching</code> configures whether the application should perform the caching features provided by the Action Controller component or not. Set to <code>false</code> in development mode, <code>true</code> in production. If it's not specified, the default will be <code>true</code>.</p></li>
<li><p><code>config.action_controller.default_static_extension</code> configures the extension used for cached pages. Defaults to <code>.html</code>.</p></li>
<li><p><code>config.action_controller.include_all_helpers</code> configures whether all view helpers are available everywhere or are scoped to the corresponding controller. If set to <code>false</code>, <code>UsersHelper</code> methods are only available for views rendered as part of <code>UsersController</code>. If <code>true</code>, <code>UsersHelper</code> methods are available everywhere. The default configuration behavior (when this option is not explicitly set to <code>true</code> or <code>false</code>) is that all view helpers are available to each controller.</p></li>
<li><p><code>config.action_controller.logger</code> accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Action Controller. Set to <code>nil</code> to disable logging.</p></li>
<li><p><code>config.action_controller.request_forgery_protection_token</code> sets the token parameter name for RequestForgery. Calling <code>protect_from_forgery</code> sets it to <code>:authenticity_token</code> by default.</p></li>
<li><p><code>config.action_controller.allow_forgery_protection</code> enables or disables CSRF protection. By default this is <code>false</code> in test mode and <code>true</code> in all other modes.</p></li>
<li><p><code>config.action_controller.forgery_protection_origin_check</code> configures whether the HTTP <code>Origin</code> header should be checked against the site's origin as an additional CSRF defense.</p></li>
<li><p><code>config.action_controller.per_form_csrf_tokens</code> configures whether CSRF tokens are only valid for the method/action they were generated for.</p></li>
<li><p><code>config.action_controller.default_protect_from_forgery</code> determines whether forgery protection is added on <code>ActionController:Base</code>. This is false by default.</p></li>
<li><p><code>config.action_controller.relative_url_root</code> can be used to tell Rails that you are <a href="configuring.html#deploy-to-a-subdirectory-relative-url-root">deploying to a subdirectory</a>. The default is <code>ENV['RAILS_RELATIVE_URL_ROOT']</code>.</p></li>
<li><p><code>config.action_controller.permit_all_parameters</code> sets all the parameters for mass assignment to be permitted by default. The default value is <code>false</code>.</p></li>
<li><p><code>config.action_controller.action_on_unpermitted_parameters</code> enables logging or raising an exception if parameters that are not explicitly permitted are found. Set to <code>:log</code> or <code>:raise</code> to enable. The default value is <code>:log</code> in development and test environments, and <code>false</code> in all other environments.</p></li>
<li><p><code>config.action_controller.always_permitted_parameters</code> sets a list of permitted parameters that are permitted by default. The default values are <code>['controller', 'action']</code>.</p></li>
<li>
<p><code>config.action_controller.enable_fragment_cache_logging</code> determines whether to log fragment cache reads and writes in verbose format as follows:</p>
<div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms)
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms)
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
</pre>
</div>
</li>
</ul>
<p> By default it is set to <code>false</code> which results in following output:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
```
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
```
</pre>
</div>
<h4 id="configuring-action-dispatch"><a class="anchorlink" href="#configuring-action-dispatch">3.9 Configuring Action Dispatch</a></h4>
<ul>
<li><p><code>config.action_dispatch.session_store</code> sets the name of the store for session data. The default is <code>:cookie_store</code>; other valid options include <code>:active_record_store</code>, <code>:mem_cache_store</code> or the name of your own custom class.</p></li>
<li>
<p><code>config.action_dispatch.default_headers</code> is a hash with HTTP headers that are set by default in each response. By default, this is defined as:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'SAMEORIGIN',
'X-XSS-Protection' => '1; mode=block',
'X-Content-Type-Options' => 'nosniff',
'X-Download-Options' => 'noopen',
'X-Permitted-Cross-Domain-Policies' => 'none',
'Referrer-Policy' => 'strict-origin-when-cross-origin'
}
</pre>
</div>
</li>
<li><p><code>config.action_dispatch.default_charset</code> specifies the default character set for all renders. Defaults to <code>nil</code>.</p></li>
<li><p><code>config.action_dispatch.tld_length</code> sets the TLD (top-level domain) length for the application. Defaults to <code>1</code>.</p></li>
<li><p><code>config.action_dispatch.ignore_accept_header</code> is used to determine whether to ignore accept headers from a request. Defaults to <code>false</code>.</p></li>
<li><p><code>config.action_dispatch.x_sendfile_header</code> specifies server specific X-Sendfile header. This is useful for accelerated file sending from server. For example it can be set to 'X-Sendfile' for Apache.</p></li>
<li><p><code>config.action_dispatch.http_auth_salt</code> sets the HTTP Auth salt value. Defaults
to <code>'http authentication'</code>.</p></li>
<li><p><code>config.action_dispatch.signed_cookie_salt</code> sets the signed cookies salt value.
Defaults to <code>'signed cookie'</code>.</p></li>
<li><p><code>config.action_dispatch.encrypted_cookie_salt</code> sets the encrypted cookies salt
value. Defaults to <code>'encrypted cookie'</code>.</p></li>
<li><p><code>config.action_dispatch.encrypted_signed_cookie_salt</code> sets the signed
encrypted cookies salt value. Defaults to <code>'signed encrypted cookie'</code>.</p></li>
<li><p><code>config.action_dispatch.authenticated_encrypted_cookie_salt</code> sets the
authenticated encrypted cookie salt. Defaults to <code>'authenticated encrypted
cookie'</code>.</p></li>
<li><p><code>config.action_dispatch.encrypted_cookie_cipher</code> sets the cipher to be
used for encrypted cookies. This defaults to <code>"aes-256-gcm"</code>.</p></li>
<li><p><code>config.action_dispatch.signed_cookie_digest</code> sets the digest to be
used for signed cookies. This defaults to <code>"SHA1"</code>.</p></li>
<li><p><code>config.action_dispatch.cookies_rotations</code> allows rotating
secrets, ciphers, and digests for encrypted and signed cookies.</p></li>
<li><p><code>config.action_dispatch.use_authenticated_cookie_encryption</code> controls whether
signed and encrypted cookies use the AES-256-GCM cipher or
the older AES-256-CBC cipher. It defaults to <code>true</code>.</p></li>
<li><p><code>config.action_dispatch.use_cookies_with_metadata</code> enables writing
cookies with the purpose and expiry metadata embedded. It defaults to <code>true</code>.</p></li>
<li><p><code>config.action_dispatch.perform_deep_munge</code> configures whether <code>deep_munge</code>
method should be performed on the parameters. See <a href="security.html#unsafe-query-generation">Security Guide</a>
for more information. It defaults to <code>true</code>.</p></li>
<li><p><code>config.action_dispatch.rescue_responses</code> configures what exceptions are assigned to an HTTP status. It accepts a hash and you can specify pairs of exception/status. By default, this is defined as:</p></li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_dispatch.rescue_responses = {
'ActionController::RoutingError' => :not_found,
'AbstractController::ActionNotFound' => :not_found,
'ActionController::MethodNotAllowed' => :method_not_allowed,
'ActionController::UnknownHttpMethod' => :method_not_allowed,
'ActionController::NotImplemented' => :not_implemented,
'ActionController::UnknownFormat' => :not_acceptable,
'ActionController::InvalidAuthenticityToken' => :unprocessable_entity,
'ActionController::InvalidCrossOriginRequest' => :unprocessable_entity,
'ActionDispatch::Http::Parameters::ParseError' => :bad_request,
'ActionController::BadRequest' => :bad_request,
'ActionController::ParameterMissing' => :bad_request,
'Rack::QueryParser::ParameterTypeError' => :bad_request,
'Rack::QueryParser::InvalidParameterError' => :bad_request,
'ActiveRecord::RecordNotFound' => :not_found,
'ActiveRecord::StaleObjectError' => :conflict,
'ActiveRecord::RecordInvalid' => :unprocessable_entity,
'ActiveRecord::RecordNotSaved' => :unprocessable_entity
}
</pre>
</div>
<p> Any exceptions that are not configured will be mapped to 500 Internal Server Error.</p>
<ul>
<li><p><code>config.action_dispatch.return_only_media_type_on_content_type</code> change the
return value of <code>ActionDispatch::Response#content_type</code> to the Content-Type
header without modification. Defaults to <code>false</code>.</p></li>
<li><p><code>ActionDispatch::Callbacks.before</code> takes a block of code to run before the request.</p></li>
<li><p><code>ActionDispatch::Callbacks.after</code> takes a block of code to run after the request.</p></li>
</ul>
<h4 id="configuring-action-view"><a class="anchorlink" href="#configuring-action-view">3.10 Configuring Action View</a></h4><p><code>config.action_view</code> includes a small number of configuration settings:</p>
<ul>
<li><p><code>config.action_view.cache_template_loading</code> controls whether or not templates should be reloaded on each request. Defaults to whatever is set for <code>config.cache_classes</code>.</p></li>
<li>
<p><code>config.action_view.field_error_proc</code> provides an HTML generator for displaying errors that come from Active Model. The default is</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
Proc.new do |html_tag, instance|
%Q(<div class="field_with_errors">#{html_tag}</div>).html_safe
end
</pre>
</div>
</li>
<li><p><code>config.action_view.default_form_builder</code> tells Rails which form builder to
use by default. The default is <code>ActionView::Helpers::FormBuilder</code>. If you
want your form builder class to be loaded after initialization (so it's
reloaded on each request in development), you can pass it as a <code>String</code>.</p></li>
<li><p><code>config.action_view.logger</code> accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Action View. Set to <code>nil</code> to disable logging.</p></li>
<li><p><code>config.action_view.erb_trim_mode</code> gives the trim mode to be used by ERB. It defaults to <code>'-'</code>, which turns on trimming of tail spaces and newline when using <code><%= -%></code> or <code><%= =%></code>. See the <a href="http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-trimspaces">Erubis documentation</a> for more information.</p></li>
<li><p><code>config.action_view.embed_authenticity_token_in_remote_forms</code> allows you to
set the default behavior for <code>authenticity_token</code> in forms with <code>remote:
true</code>. By default it's set to <code>false</code>, which means that remote forms will not
include <code>authenticity_token</code>, which is helpful when you're fragment-caching
the form. Remote forms get the authenticity from the <code>meta</code> tag, so embedding
is unnecessary unless you support browsers without JavaScript. In such case
you can either pass <code>authenticity_token: true</code> as a form option or set this
config setting to <code>true</code>.</p></li>
<li>
<p><code>config.action_view.prefix_partial_path_with_controller_namespace</code> determines whether or not partials are looked up from a subdirectory in templates rendered from namespaced controllers. For example, consider a controller named <code>Admin::ArticlesController</code> which renders this template:</p>
<div class="code_container">
<pre class="brush: ruby; html-script: true; gutter: false; toolbar: false">
<%= render @article %>
</pre>
</div>
<p>The default setting is <code>true</code>, which uses the partial at <code>/admin/articles/_article.erb</code>. Setting the value to <code>false</code> would render <code>/articles/_article.erb</code>, which is the same behavior as rendering from a non-namespaced controller such as <code>ArticlesController</code>.</p>
</li>
<li><p><code>config.action_view.raise_on_missing_translations</code> determines whether an
error should be raised for missing translations. This defaults to <code>false</code>.</p></li>
<li><p><code>config.action_view.automatically_disable_submit_tag</code> determines whether
<code>submit_tag</code> should automatically disable on click, this defaults to <code>true</code>.</p></li>
<li><p><code>config.action_view.debug_missing_translation</code> determines whether to wrap the missing translations key in a <code><span></code> tag or not. This defaults to <code>true</code>.</p></li>
<li><p><code>config.action_view.form_with_generates_remote_forms</code> determines whether <code>form_with</code> generates remote forms or not. This defaults to <code>true</code>.</p></li>
<li><p><code>config.action_view.form_with_generates_ids</code> determines whether <code>form_with</code> generates ids on inputs. This defaults to <code>false</code>.</p></li>
<li><p><code>config.action_view.default_enforce_utf8</code> determines whether forms are generated with a hidden tag that forces older versions of Internet Explorer to submit forms encoded in UTF-8. This defaults to <code>false</code>.</p></li>
</ul>
<h4 id="configuring-action-mailbox"><a class="anchorlink" href="#configuring-action-mailbox">3.11 Configuring Action Mailbox</a></h4><p><code>config.action_mailbox</code> provides the following configuration options:</p>
<ul>
<li>
<code>config.action_mailbox.logger</code> contains the logger used by Action Mailbox. It accepts a logger conforming to the interface of Log4r or the default Ruby Logger class. The default is <code>Rails.logger</code>.</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailbox.logger = ActiveSupport::Logger.new(STDOUT)
</pre>
</div>
<ul>
<li>
<code>config.action_mailbox.incinerate_after</code> accepts an <code>ActiveSupport::Duration</code> indicating how long after processing <code>ActionMailbox::InboundEmail</code> records should be destroyed. It defaults to <code>30.days</code>.</li>
</ul>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
# Incinerate inbound emails 14 days after processing.
config.action_mailbox.incinerate_after = 14.days
</pre>
</div>
<ul>
<li><p><code>config.action_mailbox.queues.incineration</code> accepts a symbol indicating the Active Job queue to use for incineration jobs. It defaults to <code>:action_mailbox_incineration</code>.</p></li>
<li><p><code>config.action_mailbox.queues.routing</code> accepts a symbol indicating the Active Job queue to use for routing jobs. It defaults to <code>:action_mailbox_routing</code>.</p></li>
</ul>
<h4 id="configuring-action-mailer"><a class="anchorlink" href="#configuring-action-mailer">3.12 Configuring Action Mailer</a></h4><p>There are a number of settings available on <code>config.action_mailer</code>:</p>
<ul>
<li><p><code>config.action_mailer.logger</code> accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Action Mailer. Set to <code>nil</code> to disable logging.</p></li>
<li>
<p><code>config.action_mailer.smtp_settings</code> allows detailed configuration for the <code>:smtp</code> delivery method. It accepts a hash of options, which can include any of these options:</p>
<ul>
<li>
<code>:address</code> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.</li>
<li>
<code>:port</code> - On the off chance that your mail server doesn't run on port 25, you can change it.</li>
<li>
<code>:domain</code> - If you need to specify a HELO domain, you can do it here.</li>
<li>
<code>:user_name</code> - If your mail server requires authentication, set the username in this setting.</li>
<li>
<code>:password</code> - If your mail server requires authentication, set the password in this setting.</li>
<li>
<code>:authentication</code> - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of <code>:plain</code>, <code>:login</code>, <code>:cram_md5</code>.</li>
<li>
<code>:enable_starttls_auto</code> - Detects if STARTTLS is enabled in your SMTP server and starts to use it. It defaults to <code>true</code>.</li>
<li>
<code>:openssl_verify_mode</code> - When using TLS, you can set how OpenSSL checks the certificate. This is useful if you need to validate a self-signed and/or a wildcard certificate. This can be one of the OpenSSL verify constants, <code>:none</code> or <code>:peer</code> -- or the constant directly <code>OpenSSL::SSL::VERIFY_NONE</code> or <code>OpenSSL::SSL::VERIFY_PEER</code>, respectively.</li>
<li>
<code>:ssl/:tls</code> - Enables the SMTP connection to use SMTP/TLS (SMTPS: SMTP over direct TLS connection).</li>
</ul>
</li>
<li>
<p><code>config.action_mailer.sendmail_settings</code> allows detailed configuration for the <code>sendmail</code> delivery method. It accepts a hash of options, which can include any of these options:</p>
<ul>
<li>
<code>:location</code> - The location of the sendmail executable. Defaults to <code>/usr/sbin/sendmail</code>.</li>
<li>
<code>:arguments</code> - The command line arguments. Defaults to <code>-i</code>.</li>
</ul>
</li>
<li><p><code>config.action_mailer.raise_delivery_errors</code> specifies whether to raise an error if email delivery cannot be completed. It defaults to <code>true</code>.</p></li>
<li><p><code>config.action_mailer.delivery_method</code> defines the delivery method and defaults to <code>:smtp</code>. See the <a href="action_mailer_basics.html#action-mailer-configuration">configuration section in the Action Mailer guide</a> for more info.</p></li>
<li><p><code>config.action_mailer.perform_deliveries</code> specifies whether mail will actually be delivered and is true by default. It can be convenient to set it to <code>false</code> for testing.</p></li>
<li>
<p><code>config.action_mailer.default_options</code> configures Action Mailer defaults. Use to set options like <code>from</code> or <code>reply_to</code> for every mailer. These default to:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
mime_version: "1.0",
charset: "UTF-8",
content_type: "text/plain",
parts_order: ["text/plain", "text/enriched", "text/html"]
</pre>
</div>
<p>Assign a hash to set additional options:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.default_options = {
from: "[email protected]"
}
</pre>
</div>
</li>
<li>
<p><code>config.action_mailer.observers</code> registers observers which will be notified when mail is delivered.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.observers = ["MailObserver"]
</pre>
</div>
</li>
<li>
<p><code>config.action_mailer.interceptors</code> registers interceptors which will be called before mail is sent.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.interceptors = ["MailInterceptor"]
</pre>
</div>
</li>
<li>
<p><code>config.action_mailer.preview_interceptors</code> registers interceptors which will be called before mail is previewed.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.preview_interceptors = ["MyPreviewMailInterceptor"]
</pre>
</div>
</li>
<li>
<p><code>config.action_mailer.preview_path</code> specifies the location of mailer previews.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
</pre>
</div>
</li>
<li>
<p><code>config.action_mailer.show_previews</code> enable or disable mailer previews. By default this is <code>true</code> in development.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.action_mailer.show_previews = false
</pre>
</div>
</li>
<li><p><code>config.action_mailer.deliver_later_queue_name</code> specifies the queue name for
mailers. By default this is <code>mailers</code>.</p></li>
<li><p><code>config.action_mailer.perform_caching</code> specifies whether the mailer templates should perform fragment caching or not. If it's not specified, the default will be <code>true</code>.</p></li>
<li><p><code>config.action_mailer.delivery_job</code> specifies delivery job for mail. Defaults to <code>ActionMailer::DeliveryJob</code>.</p></li>
</ul>
<h4 id="configuring-active-support"><a class="anchorlink" href="#configuring-active-support">3.13 Configuring Active Support</a></h4><p>There are a few configuration options available in Active Support:</p>
<ul>
<li><p><code>config.active_support.bare</code> enables or disables the loading of <code>active_support/all</code> when booting Rails. Defaults to <code>nil</code>, which means <code>active_support/all</code> is loaded.</p></li>
<li><p><code>config.active_support.test_order</code> sets the order in which the test cases are executed. Possible values are <code>:random</code> and <code>:sorted</code>. Defaults to <code>:random</code>.</p></li>
<li><p><code>config.active_support.escape_html_entities_in_json</code> enables or disables the escaping of HTML entities in JSON serialization. Defaults to <code>true</code>.</p></li>
<li><p><code>config.active_support.use_standard_json_time_format</code> enables or disables serializing dates to ISO 8601 format. Defaults to <code>true</code>.</p></li>
<li><p><code>config.active_support.time_precision</code> sets the precision of JSON encoded time values. Defaults to <code>3</code>.</p></li>
<li><p><code>config.active_support.use_sha1_digests</code> specifies whether to use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. Defaults to false.</p></li>
<li><p><code>config.active_support.use_authenticated_message_encryption</code> specifies whether to use AES-256-GCM authenticated encryption as the default cipher for encrypting messages instead of AES-256-CBC. This is false by default.</p></li>
<li><p><code>ActiveSupport::Logger.silencer</code> is set to <code>false</code> to disable the ability to silence logging in a block. The default is <code>true</code>.</p></li>
<li><p><code>ActiveSupport::Cache::Store.logger</code> specifies the logger to use within cache store operations.</p></li>
<li><p><code>ActiveSupport::Deprecation.behavior</code> alternative setter to <code>config.active_support.deprecation</code> which configures the behavior of deprecation warnings for Rails.</p></li>
<li><p><code>ActiveSupport::Deprecation.silence</code> takes a block in which all deprecation warnings are silenced.</p></li>
<li><p><code>ActiveSupport::Deprecation.silenced</code> sets whether or not to display deprecation warnings. The default is <code>false</code>.</p></li>
</ul>
<h4 id="configuring-active-job"><a class="anchorlink" href="#configuring-active-job">3.14 Configuring Active Job</a></h4><p><code>config.active_job</code> provides the following configuration options:</p>
<ul>
<li>
<p><code>config.active_job.queue_adapter</code> sets the adapter for the queuing backend. The default adapter is <code>:async</code>. For an up-to-date list of built-in adapters see the <a href="https://api.rubyonrails.org/6-0-stable/classes/ActiveJob/QueueAdapters.html">ActiveJob::QueueAdapters API documentation</a>.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
# Be sure to have the adapter's gem in your Gemfile
# and follow the adapter's specific installation
# and deployment instructions.
config.active_job.queue_adapter = :sidekiq
</pre>
</div>
</li>
<li>
<p><code>config.active_job.default_queue_name</code> can be used to change the default queue name. By default this is <code>"default"</code>.</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.active_job.default_queue_name = :medium_priority
</pre>
</div>
</li>
<li>
<p><code>config.active_job.queue_name_prefix</code> allows you to set an optional, non-blank, queue name prefix for all jobs. By default it is blank and not used.</p>
<p>The following configuration would queue the given job on the <code>production_high_priority</code> queue when run in production:</p>
<div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
config.active_job.queue_name_prefix = Rails.env