aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorJeremy Baker <jhubert@gmail.com>2016-02-04 01:32:45 -0800
committerJeremy Baker <jhubert@gmail.com>2016-02-04 01:32:45 -0800
commit7429bc58a0dffa94636b21cc0cba1d19a5ae7a84 (patch)
tree57538ab8a1d933950d20d6f78343bbf5795be129 /actionview
parentdfa48f200cbc5c1ca18457a8cde14642e12af594 (diff)
downloadrails-7429bc58a0dffa94636b21cc0cba1d19a5ae7a84.tar.gz
rails-7429bc58a0dffa94636b21cc0cba1d19a5ae7a84.tar.bz2
rails-7429bc58a0dffa94636b21cc0cba1d19a5ae7a84.zip
Remove the assumption of schema in DATABASE_URL
If you set the DATABASE_URL environment variable to `mydatabase` by accident, you end up getting a series of errors that are hard to trace. For example: ``` warning: already initialized constant ActiveRecord::Base::OrmAdapter ``` Turns out the cascade of errors is due to the error raised by `.tr` being called on `nil`. This commit makes sure that `scheme` is set before calling `.tr` on it. My previous iteration used `@uri.scheme.try(:tr, '-', '_')` but using the `&&` logical operator is a fair bit faster: http://stackoverflow.com/questions/26655032/try-vs-performance With this change, the error message becomes much more understandable: ``` FATAL: database "mydatabase" does not exist (ActiveRecord::NoDatabaseError) ```
Diffstat (limited to 'actionview')
0 files changed, 0 insertions, 0 deletions