You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/configuring.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,15 +62,15 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
62
62
63
63
* `config.autoload_paths` accepts an array of paths from which Rails will autoload constants. Default is all directories under `app`.
64
64
65
-
* `config.cache_classes` controls whether or not application classes and modules should be reloaded on each request. Defaults to `false` in development mode, and `true` in test and production modes. Can also be enabled with `threadsafe!`.
65
+
* `config.cache_classes` controls whether or not application classes and modules should be reloaded on each request. Defaults to false in development mode, and true in test and production modes. Can also be enabled with `threadsafe!`.
66
66
67
67
* `config.action_view.cache_template_loading` controls whether or not templates should be reloaded on each request. Defaults to whatever is set for `config.cache_classes`.
68
68
69
69
* `config.cache_store` configures which cache store to use for Rails caching. Options include one of the symbols `:memory_store`, `:file_store`, `:mem_cache_store`, `:null_store`, or an object that implements the cache API. Defaults to `:file_store` if the directory `tmp/cache` exists, and to `:memory_store` otherwise.
70
70
71
-
* `config.colorize_logging` specifies whether or not to use ANSI color codes when logging information. Defaults to `true`.
71
+
* `config.colorize_logging` specifies whether or not to use ANSI color codes when logging information. Defaults to true.
72
72
73
-
* `config.consider_all_requests_local` is a flag. If `true` then any error will cause detailed debugging information to be dumped in the HTTP response, and the `Rails::Info` controller will show the application runtime context in `/rails/info/properties`. `true` by default in development and test environments, and `false` in production mode. For finer-grained control, set this to `false` and implement `local_request?` in controllers to specify which requests should provide debugging information on errors.
73
+
* `config.consider_all_requests_local` is a flag. If true then any error will cause detailed debugging information to be dumped in the HTTP response, and the `Rails::Info` controller will show the application runtime context in `/rails/info/properties`. `true` by default in development and test environments, and `false` in production mode. For finer-grained control, set this to `false` and implement `local_request?` in controllers to specify which requests should provide debugging information on errors.
74
74
75
75
* `config.console` allows you to set class that will be used as console you run `rails console`. It's best to run it in`console`block:
76
76
@@ -85,17 +85,17 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
85
85
86
86
*`config.dependency_loading` is a flag that allows you to disable constant autoloading setting it to `false`. It only has effect if`config.cache_classes` is true, which it is by default in production mode. This flag is set to `false` by `config.threadsafe!`.
87
87
88
-
*`config.eager_load`when`true`, eager loads all registered `config.eager_load_namespaces`. This includes your application, engines, Rails frameworks and any other registered namespace.
88
+
*`config.eager_load`whentrue, eager loads all registered `config.eager_load_namespaces`. This includes your application, engines, Rails frameworks and any other registered namespace.
89
89
90
-
*`config.eager_load_namespaces` registers namespaces that are eager loaded when`config.eager_load` is `true`. All namespaces in the list must respond to the `eager_load!` method.
90
+
*`config.eager_load_namespaces` registers namespaces that are eager loaded when`config.eager_load` is true. All namespaces in the list must respond to the `eager_load!` method.
91
91
92
92
*`config.eager_load_paths` accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the `app` directory of the application.
93
93
94
94
*`config.encoding` sets up the application-wide encoding. Defaults to UTF-8.
95
95
96
96
*`config.exceptions_app` sets the exceptions application invoked by the ShowException middleware when an exception happens. Defaults to `ActionDispatch::PublicExceptions.new(Rails.public_path)`.
97
97
98
-
*`config.file_watcher` the class used to detect file updates in the filesystem when `config.reload_classes_only_on_change` is `true`. Must conform to `ActiveSupport::FileUpdateChecker`API.
98
+
*`config.file_watcher` the class used to detect file updates in the filesystem when `config.reload_classes_only_on_change` is true. Must conform to `ActiveSupport::FileUpdateChecker`API.
99
99
100
100
*`config.filter_parameters` used for filtering out the parameters that you don't want shown in the logs, such as passwords or credit card numbers.
101
101
@@ -109,11 +109,11 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
109
109
110
110
* `config.middleware` allows you to configure the application's middleware. This is covered in depth in the [ConfiguringMiddleware](#configuring-middleware) section below.
111
111
112
-
*`config.reload_classes_only_on_change` enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to `true`. If`config.cache_classes` is `true`, this option is ignored.
112
+
*`config.reload_classes_only_on_change` enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to true. If`config.cache_classes` is true, this option is ignored.
113
113
114
114
*`config.secret_key_base` used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get `config.secret_key_base` initialized to a random key in`config/initializers/secret_token.rb`.
115
115
116
-
*`config.serve_static_assets` configures Rails itself to serve static assets. Defaults to `true`, but in the production environment is turned off as the server software (e.g. NginxorApache) used to run the application should serve static assets instead. Unlike the default setting set this to `true`when running (absolutely not recommended!) or testing your app in production mode usingWEBrick. Otherwise you won´t be able use page caching and requests for files that exist regularly under the public directory will anyway hit your Rails app.
116
+
*`config.serve_static_assets` configures Rails itself to serve static assets. Defaults to true, but in the production environment is turned off as the server software (e.g. NginxorApache) used to run the application should serve static assets instead. Unlike the default setting set this to truewhen running (absolutely not recommended!) or testing your app in production mode usingWEBrick. Otherwise you won´t be able use page caching and requests for files that exist regularly under the public directory will anyway hit your Rails app.
117
117
118
118
*`config.session_store` is usually set up in`config/initializers/session_store.rb`and specifies what class to use to store the session. Possible values are `:cookie_store` which is the default, `:mem_cache_store`, and`:disabled`. The last one tells Railsnot to deal with sessions. Custom session stores can also be specified:
119
119
@@ -127,13 +127,13 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
127
127
128
128
*`config.beginning_of_week` sets the default beginning of week for the application. Accepts a valid week day symbol (e.g. `:monday`).
129
129
130
-
*`config.whiny_nils` enables or disables warnings when a certain set of methods are invoked on `nil`and it does not respond to them. Defaults to `true`in development andtest environments.
130
+
*`config.whiny_nils` enables or disables warnings when a certain set of methods are invoked on `nil`and it does not respond to them. Defaults to truein development andtest environments.
131
131
132
132
### Configuring Assets
133
133
134
134
*`config.assets.enabled` a flag that controls whether the asset pipeline is enabled. It is explicitly initialized in`config/application.rb`.
135
135
136
-
*`config.assets.compress` a flag that enables the compression of compiled assets. It is explicitly set to `true`in`config/production.rb`.
136
+
*`config.assets.compress` a flag that enables the compression of compiled assets. It is explicitly set to truein`config/production.rb`.
137
137
138
138
*`config.assets.css_compressor` defines the CSS compressor to use. It is set by default by `sass-rails`. The unique alternative value at the moment is `:yui`, which uses the `yui-compressor` gem.
*`config.active_record.table_name_suffix` lets you set a global string to be appended to table names. If you set this to `_northwest`, then the Customerclass will look for `customers_northwest` as its table. The default is an empty string.
260
260
261
-
*`config.active_record.pluralize_table_names` specifies whether Rails will look for singular or plural table names in the database. If set to `true` (the default), then the Customerclass will use the `customers` table. If set to `false`, then the Customerclass will use the `customer` table.
261
+
*`config.active_record.pluralize_table_names` specifies whether Rails will look for singular or plural table names in the database. If set to true (the default), then the Customerclass will use the `customers` table. If set to false, then the Customerclass will use the `customer` table.
262
262
263
263
*`config.active_record.default_timezone` determines whether to use `Time.local` (if set to `:local`) or`Time.utc` (if set to `:utc`) when pulling dates and times from the database. The default is `:utc`forRails, although ActiveRecord defaults to `:local`when used outside of Rails.
264
264
265
265
*`config.active_record.schema_format` controls the formatfor dumping the database schema to a file. The options are `:ruby` (the default) for a database-independent version that depends on migrations, or`:sql`for a set of (potentially database-dependent) SQL statements.
266
266
267
-
*`config.active_record.timestamped_migrations` controls whether migrations are numbered with serial integers or with timestamps. The default is `true`, to use timestamps, which are preferred if there are multiple developers working on the same application.
267
+
*`config.active_record.timestamped_migrations` controls whether migrations are numbered with serial integers or with timestamps. The default is true, to use timestamps, which are preferred if there are multiple developers working on the same application.
268
268
269
-
*`config.active_record.lock_optimistically` controls whether ActiveRecord will use optimistic locking and is `true` by default.
269
+
*`config.active_record.lock_optimistically` controls whether ActiveRecord will use optimistic locking and is true by default.
270
270
271
271
*`config.active_record.cache_timestamp_format` controls the format of the timestamp value in the cache key. Default is `:number`.
272
272
273
273
TheMySQL adapter adds one additional configuration option:
274
274
275
-
*`ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans` controls whether ActiveRecord will consider all `tinyint(1)` columns in a MySQL database to be booleans and is `true` by default.
275
+
*`ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans` controls whether ActiveRecord will consider all `tinyint(1)` columns in a MySQL database to be booleans and is true by default.
276
276
277
277
The schema dumper adds one additional configuration option:
278
278
@@ -370,11 +370,11 @@ There are a number of settings available on `config.action_mailer`:
370
370
*`:location`-The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.
371
371
*`:arguments`-The command line arguments. Defaults to `-i -t`.
372
372
373
-
*`config.action_mailer.raise_delivery_errors` specifies whether to raise an error if email delivery cannot be completed. It defaults to `true`.
373
+
*`config.action_mailer.raise_delivery_errors` specifies whether to raise an error if email delivery cannot be completed. It defaults to true.
374
374
375
375
*`config.action_mailer.delivery_method` defines the delivery method. The allowed values are `:smtp` (default), `:sendmail`, and`:test`.
376
376
377
-
*`config.action_mailer.perform_deliveries` specifies whether mail will actually be delivered and is `true` by default. It can be convenient to set it to `false`for testing.
377
+
*`config.action_mailer.perform_deliveries` specifies whether mail will actually be delivered and is true by default. It can be convenient to set it to `false`for testing.
378
378
379
379
*`config.action_mailer.default_options` configures ActionMailer defaults. Use to set options like `from`or`reply_to`for every mailer. These default to:
380
380
@@ -622,13 +622,13 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
622
622
623
623
*`set_clear_dependencies_hook`Provides a hook for`active_record.set_dispatch_hooks` to use, which will run before this initializer. This initializer — which runs only if`cache_classes` is set to `false` — uses `ActionDispatch::Callbacks.after` to remove the constants which have been referenced during the request from the object space so that they will be reloaded during the following request.
624
624
625
-
*`initialize_dependency_mechanism`If`config.cache_classes` is `true`, configures `ActiveSupport::Dependencies.mechanism` to `require` dependencies rather than `load` them.
625
+
*`initialize_dependency_mechanism`If`config.cache_classes` is true, configures `ActiveSupport::Dependencies.mechanism` to `require` dependencies rather than `load` them.
626
626
627
627
*`bootstrap_hook`Runs all configured `before_initialize` blocks.
628
628
629
629
*`i18n.callbacks`In the development environment, sets up a `to_prepare` callback which will call `I18n.reload!`if any of the locales have changed since the last request. In production mode this callback will only run on the first request.
630
630
631
-
*`active_support.initialize_whiny_nils`Requires`active_support/whiny_nil`if`config.whiny_nils` is `true`. This file will output errors such as:
631
+
*`active_support.initialize_whiny_nils`Requires`active_support/whiny_nil`if`config.whiny_nils` is true. This file will output errors such as:
632
632
633
633
```
634
634
Called id fornil, which would mistakenly be 4 — if you really wanted the id of nil, use object_id
@@ -660,7 +660,7 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
660
660
661
661
* `action_controller.compile_config_methods` Initializes methods for the config settings specified so that they are quicker to access.
662
662
663
-
* `active_record.initialize_timezone` Sets `ActiveRecord::Base.time_zone_aware_attributes` to `true`, as well as setting `ActiveRecord::Base.default_timezone` to UTC. When attributes are read from the database, they will be converted into the time zone specified by `Time.zone`.
663
+
* `active_record.initialize_timezone` Sets `ActiveRecord::Base.time_zone_aware_attributes` to true, as well as setting `ActiveRecord::Base.default_timezone` to UTC. When attributes are read from the database, they will be converted into the time zone specified by `Time.zone`.
664
664
665
665
* `active_record.logger` Sets `ActiveRecord::Base.logger` — if it's not already set — to `Rails.logger`.
666
666
@@ -708,13 +708,13 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
708
708
709
709
* `build_middleware_stack` Builds the middleware stack for the application, returning an object which has a `call` method which takes a Rack environment object for the request.
710
710
711
-
* `eager_load!` If `config.eager_load` is `true`, runs the `config.before_eager_load` hooks and then calls `eager_load!` which will load all `config.eager_load_namespaces`.
711
+
* `eager_load!` If `config.eager_load` is true, runs the `config.before_eager_load` hooks and then calls `eager_load!` which will load all `config.eager_load_namespaces`.
712
712
713
713
* `finisher_hook` Provides a hook for after the initialization of process of the application is complete, as well as running all the `config.after_initialize` blocks for the application, railties and engines.
714
714
715
715
* `set_routes_reloader` Configures Action Dispatch to reload the routes file using `ActionDispatch::Callbacks.to_prepare`.
716
716
717
-
* `disable_dependency_loading` Disables the automatic dependency loading if the `config.eager_load` is set to `true`.
717
+
* `disable_dependency_loading` Disables the automatic dependency loading if the `config.eager_load` is set to true.
0 commit comments