diff options
author | eileencodes <eileencodes@gmail.com> | 2019-03-18 16:23:00 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2019-03-18 16:23:00 -0400 |
commit | 8f3066fccc3b80fa3bfaa2830858f61f046bd61a (patch) | |
tree | b740af3ae555762eb2e4627f00f256240e27a0ba /railties/test | |
parent | 98d0f93506b0b97804d0d510ffcc435af9b2a2d5 (diff) | |
download | rails-8f3066fccc3b80fa3bfaa2830858f61f046bd61a.tar.gz rails-8f3066fccc3b80fa3bfaa2830858f61f046bd61a.tar.bz2 rails-8f3066fccc3b80fa3bfaa2830858f61f046bd61a.zip |
Fix database configuration when adding another config level
This is kind of hard to explain but if you have a database config with
another level like this:
```
development:
primary:
database: "my db"
variables:
statement_timeout: 1000
```
the database configurations code would chooke on the `variables` level
because it didn't know what to do with it.
We'd see the following error:
```
lib/active_record/database_configurations.rb:72:in
`block in find_db_config': undefined method `env_name' for [nil]:Array
(NoMethodError)
```
The problem here is that Rails does correctly identify this as not a
real configuration but returns `[nil]` along with the others. We need to
make sure to flatten the array and remove all the `nil`'s before
returning the `configurations` objects.
Fixes #35646
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 14cdf1ab7c..3fcfaa9623 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -123,6 +123,8 @@ module TestHelpers adapter: sqlite3 pool: 5 timeout: 5000 + variables: + statement_timeout: 1000 development: primary: <<: *default |