aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/configuration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* new config to opt-out from adding app directories to $LOAD_PATHXavier Noria2019-04-281-0/+28
|
* Revert "Include Caching module for ActionController::API"Rafael França2019-04-221-13/+0
|
* Make sure api controllers can perform caching as wellst00122019-04-191-0/+13
| | | | | | | | | | Currently ActionController::API doesn't include Caching module, so it can't perform caching. And even if users include it later manually, it won't inherit application's default cache store for action_controllers. So the only way to solve this issue is to include Caching module in ActionController::API, too. This closes #35602
* Squash warning: possibly useless use of a constantutilum2019-04-161-2/+2
| | | | in void context
* deprecates autoloading constants during initialization [closes #35745]Xavier Noria2019-04-141-0/+55
| | | | See rationale in the warning message included in the patch.
* Add config.disable_sandbox option to Rails consolePrem Sichanugrist2019-03-231-0/+16
| | | | | | | | | | | A long-running `rails console --sandbox` could cause a database server to become out-of-memory as it's holding on to changes that happen on the database. Given that it's common for Ruby on Rails application with huge traffic to have separate write database and read database, we should allow the developers to disable this sandbox option to prevent someone from accidentally causing the Denial-of-Service on their server.
* Make application work without tmp directoryyuuji.yaginuma2019-03-141-0/+3
| | | | | | | | | | | | The tmp directory is added to version control in the newly created application. This was added in Rails 5.0.0(https://github.com/rails/rails/commit/f06ce4c12a396795a3b2c1812951d9277bcb3a82). However, applications created before that are not guaranteed to have the tmp directory. If the tmp directory does not exist, writing to the key file raise error. This is a bit incompatible. So I fixed that create the directory before writing a key.
* Merge tag 'v6.0.0.beta3'eileencodes2019-03-131-1/+21
|\ | | | | | | v6.0.0.beta3 release
| * Fix possible dev mode RCEAaron Patterson2019-03-101-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | If the secret_key_base is nil in dev or test generate a key from random bytes and store it in a tmp file. This prevents the app developers from having to share / checkin the secret key for dev / test but also maintains a key between app restarts in dev/test. [CVE-2019-5420] Co-Authored-By: eileencodes <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* | Allow autoloader inflectors to be swaped outJean Boussier2019-03-081-0/+4
|/
* Replace autoloader accessors with Rails.autoloaders.{main,once}Xavier Noria2019-02-141-10/+17
| | | | | | | | | | | | | | | | Rails.autoloader and Rails.once_autoloader was just tentative API good enough for a first patch. Rails.autoloader is singular and does not convey in its name that there is another autoloader. That might be confusing, for example if you set a logger and miss traces. On the other hand, the name `once_autoloader` is very close to being horrible. Rails.autoloaders.main and Rails.autoloaders.once read better for my taste, and have a nice symmetry. Also, both "main" and "once" are four letters long, short and same length. They are tagged as "rails.main" and "rails.once", respectively. References #35235.
* Fix the `config_for` to always return a NonSymbolAccessDeprecatedHash:Edouard CHIN2019-02-141-0/+22
| | | | | | | | | | | | | | | | | | - If you have hashes inside array, the hashes were getting initialized as regular HWIA wereas we want them to be NonSymbolAccessDeprecatedHash in order to trigger a deprecation warning when keys are accessed with string. This patch fixes that by overwriting the `[]=` to to the same as what HWIA does (with the difference that we don't call `convert_key` to not trigger a deprecation when setting value). I also took the liberty to extract `hash.nested_under_indifferent_access`, into a separate method to allow subclasses to return whatever they want. Inheriting HWIA is not common, but I think it's useful for cases like this one where we want to preprocess reading and writing values in the hash (for deprecation purposes or other reasons).
* Zeitwerk integrationXavier Noria2019-02-121-0/+21
|
* Fix assertion excpected/actual orderUfuk Kayserilioglu2019-02-111-6/+6
| | | | | | | | The assertion from the previous PR had the expected and the actual values in the wrong order, so when a test failed the error message was confusing. This commit fixes the problem by switching the order.
* Allow deprecated non-symbol access to nested `config_for` hashesUfuk Kayserilioglu2019-02-111-1/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | A change to `Rails::Application.config_for` in https://github.com/rails/rails/pull/33815 and https://github.com/rails/rails/pull/33882 has altered the behaviour of the returned object in a breaking manner. Before that change, nested hashes returned from `config_for` could be accessed using non-symbol keys. After the change, all keys are recursively symbolized so non-symbol access fails to read the expected values. This is a breaking change for any app that might be relying on the nested hashes returned from `config_for` calls, and thus should be deprecated before being removed from the codebase. This commit introduces a temporary `NonSymbolAccessDeprecatedHash` class that recursively wraps any nested hashes inside the `OrderedOptions` object returned from `config_for` and issues a deprecation notice when a non-symbol based access is performed. This way, apps that are still relying on the ability to access these nested hashes using non-symbol keys will be able to observe the deprecation notices and have time to implement changes before non-symbol access is removed for good. A CHANGELOG entry is also added to note that non-symbol access to nested `config_for` hashes is deprecated.
* Deprecate finalizer configuration (it doesn't do anything)Aaron Patterson2019-02-061-0/+21
| | | | | | Revert "Remove finalizer and configuration" This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
* Remove finalizer and configurationAaron Patterson2019-02-061-17/+0
|
* Cleanup the whitelisting references after #33145Genadi Samokovarov2019-02-031-1/+1
| | | | | | | | | | | | During the development of #33145, I have named a few concepts in the code as `whitelisted`. We decided to stay away from the term and I adjusted most of the code afterwards, but here are the cases I forgot to change. I also found a case in the API guide that we could have cleaned up as well. [ci skip]
* Subdomains of localhost are safe against DNS rebindingMarc Schütz2019-01-231-0/+5
|
* Remove deprecated `config.secret_token`Rafael Mendonça França2019-01-171-82/+0
|
* Change `SQLite3Adapter` to always represent boolean values as integersRafael Mendonça França2019-01-171-19/+11
|
* Move MailDeliveryJob default to 6.0 defaultsGannon McGibbon2019-01-071-0/+27
|
* Test Action Mailbox configurationsbogdanvlviv2019-01-041-0/+71
| | | | Related to https://github.com/rails/rails/commit/0d40c62213cf0be58a470637bd364e92c5666402
* Send Active Storage jobs to dedicated queues by defaultGeorge Claghorn2019-01-041-0/+28
| | | Match Action Mailbox, which sets a default queue for each of its two jobs.
* Merge pull request #33985 from eugeneius/attribute_methods_schema_cacheKasper Timm Hansen2019-01-031-1/+63
|\ | | | | Only define attribute methods from schema cache
| * Only define attribute methods from schema cacheEugene Kenny2018-09-281-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | To define the attribute methods for a model, Active Record needs to know the schema of the underlying table, which is usually achieved by making a request to the database. This is undesirable behaviour while the app is booting, for two reasons: it makes the boot process dependent on the availability of the database, and it means every new process will make one query for each table, which can cause issues for large applications. However, if the application is using the schema cache dump feature, then the schema cache already contains the necessary information, and we can define the attribute methods without causing any extra database queries.
* | Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-7/+5
| | | | | | | | | | | | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* | Improve deprecation message for enqueue returning falseRafael Mendonça França2018-12-051-0/+27
| | | | | | | | | | | | And make sure new applications in Rails 6.0 has this config enabled. Also, improve test coverage and add a CHANGELOG entry.
* | Merge pull request #33882 from ↵Rafael França2018-11-301-26/+54
|\ \ | | | | | | | | | | | | mberlanda/mberlanda/as-inheritable-options-intialization [Realties] config_for as ActiveSupport::OrderedOptions
| * | chore: implement config_for as ActiveSupport::OrderedOptionsMauro Berlanda2018-10-191-26/+54
| |/
* | Remove asset paths from eager_load_paths and autoload_pathsGannon McGibbon2018-11-091-0/+8
| | | | | | | | | | Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.
* | Implement AR#inspect using ParamterFilter.Yoshiyuki Kinjo2018-10-191-1/+1
|/ | | | | | | | | AR instance support `filter_parameters` since #33756. Though Regex or Proc is valid as `filter_parameters`, they are not supported as AR#inspect. I also add :mask option and #filter_params to `ActiveSupport::ParameterFilter#new` to implement this.
* Eagerly define attribute methods in productionEugene Kenny2018-09-241-0/+47
| | | | | | | | | | | | | The attribute methods for a model are currently defined lazily the first time that model is instantiated, even when `config.eager_load` is true. This means the first request to use each model incurs the cost, which usually involves a database round trip to fetch the schema definition. By defining the attribute methods for all models while the application is booting, we move that work out of any individual request. When using a forking web server, this also reduces the number of times the schema definition is queried by doing it once in the parent process instead of from each forked process during their first request.
* Switch to supports_cache_versioning? check to a class methodschneems2018-09-201-1/+1
| | | | | - Moving the `supports_cache_versioning?` check to a class method. - Shorten the method doc. - Expand on the error message.
* [close #33907] Error when using "recyclable" cache keys with a store that ↵schneems2018-09-201-0/+12
| | | | | | | | | | | | | | does not support it If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate. This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via ``` config.active_record.cache_versioning = true ``` Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method `supports_in_cache_versioning?` and returning true.
* Add test for `config.active_storage.routes_prefix`yuuji.yaginuma2018-09-151-0/+18
| | | | Follow up #33883.
* Build string set when `filter_attributes` is assignedbogdanvlviv2018-09-121-1/+2
| | | | | | | | | It would allow `filter_attributes` to be reused across multiple calls to `#inspect` or `#pretty_print`. - Add `require "set"` - Remove `filter_attributes` instance reader. I think there is no need to keep it.
* refacto: config_for with ActiveSupport::InheritableOptions and symbolized keysMauro Berlanda2018-09-111-2/+49
|
* Configuration item `config.filter_parameters` could also filter out ↵Zhang Kang2018-09-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | sensitive value of database column when call `#inspect` * Why Some sensitive data will be exposed in log accidentally by calling `#inspect`, e.g. ```ruby @account = Account.find params[:id] payload = { account: @account } logger.info "payload will be #{ payload }" ``` All the information of `@account` will be exposed in log. * Solution Add a class attribute filter_attributes to specify which values of columns shouldn't be exposed. This attribute equals to `Rails.application.config.filter_parameters` by default. ```ruby Rails.application.config.filter_parameters += [:credit_card_number] Account.last.insepct # => #<Account id: 123, credit_card_number: [FILTERED] ...> ```
* Add test case that configure ↵yuuji.yaginuma2018-05-201-0/+17
| | | | | | `config.action_view.finalize_compiled_template_methods` Follow up of #32418.
* Fix typo on method nameAlberto Almagro2018-04-201-1/+1
|
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-1/+1
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Merge pull request #32065 from ↵Kasper Timm Hansen2018-04-021-1/+1
|\ | | | | | | | | sikachu/move-SourceAnnotationExtractor-under-rails-namespec Move SourceAnnotationExtractor under Rails module
| * Move SourceAnnotationExtractor under Rails modulePrem Sichanugrist2018-03-221-1/+1
| | | | | | | | This class should be under Rails module as it belongs to Rails.
* | Deriving `secret_key_base` breaks `key_generator` defined in 5.1.Yoshiyuki Kinjo2018-03-311-0/+1
|/ | | | | | | | | | | If one created Rails 5.1 app and then updated to 5.2, `secret_key_base` defined in `config/secrets.yml` is ignored for `development` and `test` environment. A change in `secret_key_base` in turn breaks `Rails.application.key_generator`. If one encrypt data in Rails 5.1, she cannot decrypt it in Rails 5.2 for `development` and `test` environment.
* Don't enforce UTF-8 by defaultAndrew White2018-02-271-5/+31
| | | | | | 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.
* Fix custome serializer settingYuji Yaginuma2018-02-161-0/+12
| | | | | | | | The serializer should be set up in `after_initialize` so that it work properly even if the user specifies serializer with initializers. Also, since `custom_serializers` is `Array`, it needs to be flattened before setting the value.
* Remove extra whitespaceDaniel Colson2018-01-251-5/+5
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
|
* Change refute to assert_notDaniel Colson2018-01-251-1/+1
|