aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/configuring.md
Commit message (Collapse)AuthorAgeFilesLines
* Change queueing to queuing in docs and comments [skip ci]jacobherrington2018-11-181-1/+1
| | | | | | | | | My spellchecker flagged this as an incorrect spelling, upon further research it appears to be a point of contention in English. Either way might work. After further examination queuing is much more common in the Rails codebase so making this change will serve to standardize the spelling.
* Add support for UNLOGGED Postgresql tablesJacob Evelyn2018-11-131-0/+8
| | | | | | | | | | | This commit adds support for the `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables` setting, which turns `CREATE TABLE` SQL statements into `CREATE UNLOGGED TABLE` statements. This can improve PostgreSQL performance but at the cost of data durability, and thus it is highly recommended that you *DO NOT* enable this in a production environment.
* Restore `encoding: utf8mb4` in database.ymlYasuo Honda2018-10-301-0/+1
| | | | | | | rails/rails#33853 and rails/rails#33929 removed `encoding: utf8mb4` from database.yml since at that time MySQL 5.1 is supported with the master branch. Since MySQL 5.1 has been dropped, we can restore `encoding: utf8mb4` in database.yml
* Remove `javascripts` and `javascript_engine` options for generatorsbogdanvlviv2018-10-221-2/+0
| | | | It is unused since #33079
* Fix the LoggerSilence to work as described:Edouard CHIN2018-10-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Following the Rails guide which state that a logger needs to include the `ActiveSupport::LoggerSilence` as well as `ActiveSupport::LoggerThreadSafe` modules isn't enough and won't work. Here is a test cases with 3 tests that all fails https://gist.github.com/Edouard-chin/4a72930c2b1eafbbd72a80c66f102010 The problems are the following: 1) The logger needs to call `after_initialize` in order to setup some instance variables. 2) The silence doesn't actually work because the bare ruby Logger `add` method checks for the instance variable `@logger`. We need to override the `add` (like we used to in the ActiveSupport::Logger class). 3) Calling `debug?` `info?` etc... doesn't work as the bare ruby methods will check for the instance variable. Again we need to override this methods (like we used to in the ActiveSupport::Logger class) The LoggerSilence won't work without LoggerThreadSafe, but the later is not public API, the user shouldn't have to include it so I modified to include it automatically. Same for the `after_initialize` method. I find unuintitive to have to call it directly. I modified to instance the variables when the module get included.
* Deprecate the `LoggerSilence` constant:Edouard CHIN2018-10-021-2/+2
| | | | | | | | - I found this weird that the LoggerSilence wasn't using the `ActiveSupport` namespace (AFAIK all other classes have it). This PR deprecate the use of `LoggerSilence` for `ActiveSupport::LoggerSilence` instead.
* Update MySQL server version and character set in Rails Guide [skip ci]Yasuo Honda2018-09-201-1/+2
| | | | Related to #33853
* Configure Active Storage route prefixChris Bisnett2018-09-141-0/+8
| | | | | | | | | | | Applications can configure the route prefix prepended to the Active Storage routes. By default this maintains the previous prefix `/rails/active_storage` but supports custom prefixes. Before this change the route for serving blobs is fixed to `/rails/active_storage/blobs/:signed_id/*filename`. After this change it's possible to configure the route to something like `/files/blobs/:signed_id/*filename`.
* Add `:redis_cache_store` to `config.cache_store` options [ci skip]yuuji.yaginuma2018-09-141-1/+1
|
* Clarify docs of `config.filter_parameters` and `#filter_attributes`bogdanvlviv2018-09-121-1/+1
| | | | | Add mention that `config.filter_parameters` also filters out sensitive values of database columns when call `#inspect` since #33756.
* use "minitest" consistentlyXavier Noria2018-09-111-1/+1
| | | | | | | | | The name of the minitest library is spelled that way: regular font, and lowercase. Lowercase is used even at the beginning of sentences, see http://docs.seattlerb.org/minitest/ I double-checked this with @zenspider too (thanks!).
* Fix sqlite3 url config in "Configuring Rails Applications" guidebogdanvlviv2018-09-091-3/+3
| | | | | See `ConnectionUrlResolver#database_from_path` in `activerecord/lib/active_record/connection_adapters/connection_specification.rb`
* Merge pull request #33637 from eileencodes/ar-connection-management-refactoringEileen M. Uchitelle2018-08-301-4/+28
|\ | | | | Refactor Active Record configurations
| * Refactors Active Record connection managementEileen Uchitelle2018-08-301-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the three-tier config makes it easier to define databases for multiple database applications, it quickly became clear to offer full support for multiple databases we need to change the way the connections hash was handled. A three-tier config means that when Rails needed to choose a default configuration (in the case a user doesn't ask for a specific configuration) it wasn't clear to Rails which the default was. I [bandaid fixed this so the rake tasks could work](#32271) but that fix wasn't correct because it actually doubled up the configuration hashes. Instead of attemping to manipulate the hashes @tenderlove and I decided that it made more sense if we converted the hashes to objects so we can easily ask those object questions. In a three tier config like this: ``` development: primary: database: "my_primary_db" animals: database; "my_animals_db" ``` We end up with an object like this: ``` @configurations=[ #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10 @env_name="development",@spec_name="primary", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>, #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90 @env_name="development",@spec_name="animals", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}> ]> ``` The configurations setter takes the database configuration set by your application and turns them into an `ActiveRecord::DatabaseConfigurations` object that has one getter - `@configurations` which is an array of all the database objects. The configurations getter returns this object by default since it acts like a hash in most of the cases we need. For example if you need to access the default `development` database we can simply request it as we did before: ``` ActiveRecord::Base.configurations["development"] ``` This will return primary development database configuration hash: ``` { "database" => "my_primary_db" } ``` Internally all of Active Record has been converted to use the new objects. I've built this to be backwards compatible but allow for accessing the hash if needed for a deprecation period. To get the original hash instead of the object you can either add `to_h` on the configurations call or pass `legacy: true` to `configurations. ``` ActiveRecord::Base.configurations.to_h => { "development => { "database" => "my_primary_db" } } ActiveRecord::Base.configurations(legacy: true) => { "development => { "database" => "my_primary_db" } } ``` The new configurations object allows us to iterate over the Active Record configurations without losing the known environment or specification name for that configuration. You can also select all the configs for an env or env and spec. With this we can always ask any object what environment it belongs to: ``` db_configs = ActiveRecord::Base.configurations.configurations_for("development") => #<ActiveRecord::DatabaseConfigurations:0x00007fd1acbdf800 @configurations=[ #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10 @env_name="development",@spec_name="primary", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>, #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90 @env_name="development",@spec_name="animals", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}> ]> db_config.env_name => "development" db_config.spec_name => "primary" db_config.config => { "adapter"=>"sqlite3", "database"=>"db/development.sqlite3" } ``` The configurations object is more flexible than the configurations hash and will allow us to build on top of the connection management in order to add support for primary/replica connections, sharding, and constructing queries for associations that live in multiple databases.
* | Add info about `config.action_dispatch.use_cookies_with_metadata` to ↵bogdanvlviv2018-08-301-0/+3
|/ | | | | | "Configuring Rails Applications" guide [ci skip] Related to #32937, #33605.
* Merge pull request #33681 from minaslater/replace-white-and-blacklistAaron Patterson2018-08-231-2/+2
|\ | | | | [ci skip] change all instances of blacklist and whitelist to denylist…
| * [ci skip] corrects more grammar awkwardness, replacing denylist with ↵Mina Slater2018-08-221-2/+2
| | | | | | | | restricted list and consistently use permitted
| * [ci skip] fixes a few more grammar issues, changing a to an before the word ↵Mina Slater2018-08-221-1/+1
| | | | | | | | allowlist
| * [ci skip] fixes awkward grammarMina Slater2018-08-221-2/+2
| |
| * [ci skip] change all instances of blacklist and whitelist to denylist and ↵Mina Slater2018-08-211-2/+2
| | | | | | | | allowlist
* | Add database configuration to disable advisory locks.Guo Xiang Tan2018-08-221-1/+10
|/ | | | https://github.com/rails/rails/issues/31190
* Merge pull request #33229 from ↵Matthew Draper2018-07-251-4/+4
|\ | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * Recommend use of rails over bin/railsAlberto Almagro2018-07-061-4/+4
| | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | Rails guides are now served over httpsPaul McMahon2018-07-241-1/+1
|/ | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* Permit configuring the default service URL expiryGeorge Claghorn2018-06-211-0/+7
|
* add documentation for ↵Thomas Dziedzic2018-06-201-0/+2
| | | | | | config.active_support.use_authenticated_message_encryption [ci skip] related to https://github.com/rails/rails/issues/33170
* Fix Active Storage configuration example [ci skip]yuuji.yaginuma2018-06-161-2/+2
| | | | It is necessary to specify a value to `config.active_storage`.
* Add missing documentation about `config.action_mailer.preview_interceptors` ↵yuuji.yaginuma2018-06-141-0/+6
| | | | [ci skip]
* Add changelog for #32956 [ci skip]bogdanvlviv2018-06-121-1/+1
| | | | Add mention about default value of `config.active_model.i18n_full_message`.
* Fix active_model/errors docs [ci skip]bogdanvlviv2018-06-121-1/+1
| | | | | | | - Fix indentation. - Add a missing dot to the end of the sentence. Related to #32956
* Merge pull request #32956 from Shopify/i18n_activemodel_errors_full_messageRafael França2018-06-111-0/+4
|\ | | | | Allow to override the full_message error format
| * Add global config for config.active_model.i18n_full_messageMartin Larochelle2018-06-051-0/+4
| |
* | Update `config.active_storage.variable_content_types` default value in ↵yuuji.yaginuma2018-06-101-1/+1
| | | | | | | | | | | | guides [ci skip] Follow up of 3915a47.
* | Correct default value of `unknown_asset_fallback`James Adam2018-06-041-1/+1
| | | | | | | | | | `Rails.application.config.assets.unknown_asset_fallback` now defaults to `false` in an unmodified Rails application. [ci skip]
* | Added a lot of Oxford commasAnthony Crumley2018-05-101-10/+10
| | | | | | | | | | | | | | [ci skip] A regular expression was used to find a lot of missing Oxford commas and add them. The regular expression was as follows. ", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
* | Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-221-1/+1
| |
* | Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
* Add `action_view.finalize_compiled_template_methods` config optionSimon Coffey2018-04-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | ActionView::Template instances compile their source to methods on the ActionView::CompiledTemplates module. To prevent leaks in development mode, where templates can frequently change, a finalizer is added that undefines these methods[1] when the templates are garbage-collected. This is undesirable in the test environment, however, as templates don't change during the life of the test. Moreover, the cost of undefining a method is proportional to the number of descendants a class or module has, since the method cache must be cleared for all descendant classes. As ActionView::CompiledTemplates is mixed into every ActionView::TestCase (or in RSpec suites, every view spec example group), it can end up with a very large number of descendants, and undefining its methods can become very expensive. In large test suites, this results in a long delay at the end of the test suite as all template finalizers are run, only for the process to then exit. To avoid this unnecessary cost, this change adds a config option, `action_view.finalize_compiled_template_methods`, defaulting to true, and sets it to false in the test environment only. [1] https://github.com/rails/rails/blob/09b2348f7fc8d4e7191e70e06608c5909067e2aa/actionview/lib/action_view/template.rb#L118-L126
* Move fk_ignore_pattern from config.active_record to SchemaDumperDavid Stosik2018-03-221-7/+7
| | | | | This makes more sense, as the foreign key ignore pattern is only used by the schema dumper.
* Document config.active_record.fk_ignore_patternDavid Stosik2018-03-201-0/+6
|
* Update "Upgrading from Rails 5.1 to Rails 5.2" [ci skip]bogdanvlviv2018-03-141-0/+4
| | | | | | | | | | | Add section "Expiry in signed or encrypted cookie is now embedded in the cookies values" to `master` since it should always be in the guides, not only for version 5.2. Add info about `config.action_dispatch.use_authenticated_cookie_encryption` to the "Configuring Rails Applications" guide. It was committed straight to `5-2-stable` since we don't need this functionality in 6.0. Related to b25fcbc074ea688765af62a163698d5449221a8c.
* Don't enforce UTF-8 by defaultAndrew White2018-02-271-0/+2
| | | | | | With the disabling of TLS 1.0 by most major websites, continuing to run IE8 or lower becomes increasingly difficult so default to not enforcing UTF-8 encoding as it's not relevant to other browsers.
* Add configuration to set custom serializersRafael Mendonça França2018-02-141-0/+2
|
* Add docs on how to configure Active Storageclaudiob2018-02-081-0/+35
| | | | [ci skip]
* Update `action_dispatch.default_headers` default value [ci skip]yuuji.yaginuma2018-01-281-1/+4
| | | | This was changed with 5d7b70f and 428939b.
* Clarify autoload_paths and eager_load in guides per current usage. [CI SKIP]Tim Diggins2018-01-211-1/+1
|
* Allow `false` for `config.generators.system_tests=`bogdanvlviv2018-01-181-0/+1
| | | | | Mention `config.generators.system_tests` in the "Configuring Rails Applications" guide.
* Use SHA-1 for non-sensitive digests by defaultEugene Kenny2018-01-081-0/+2
| | | | | | Instead of providing a configuration option to set the hash function, switch to SHA-1 for new apps and allow upgrading apps to opt in later via `new_framework_defaults_5_2.rb`.
* Move `config.action_view.cache_template_loading` to proper section in ↵fatkodima2018-01-031-2/+2
| | | | configuring.md [ci skip]
* Update 'Configuring Rails Applications' guidebogdanvlviv2017-12-121-0/+4
| | | | | - Add mention about `config.active_record.internal_metadata_table_name` - Add mention about `config.active_record.protected_environments`