diff options
author | Pavel Penkov <ebonfortress@gmail.com> | 2014-12-25 16:21:20 +0300 |
---|---|---|
committer | Pavel Penkov <ebonfortress@gmail.com> | 2014-12-25 16:34:28 +0300 |
commit | 290e8e117fd33189fec25d13b37e686b27247ad1 (patch) | |
tree | 74d25f63ce50e772d829a8d92893d6bc080e9550 | |
parent | a2059068c02c25e61cc7d5701b0bbd2913e4012f (diff) | |
download | rails-290e8e117fd33189fec25d13b37e686b27247ad1.tar.gz rails-290e8e117fd33189fec25d13b37e686b27247ad1.tar.bz2 rails-290e8e117fd33189fec25d13b37e686b27247ad1.zip |
Check for Rails.env instead of Rails
`Rails` constant is added by rails-html-sanitizer leading to bugs in
non-Rails apps using ActiveRecord and ActionMailer
-rw-r--r-- | activerecord/lib/active_record/connection_handling.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 8f51590c99..984af79642 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -1,6 +1,6 @@ module ActiveRecord module ConnectionHandling - RAILS_ENV = -> { (Rails.env if defined?(Rails)) || ENV["RAILS_ENV"] || ENV["RACK_ENV"] } + RAILS_ENV = -> { (Rails.env if defined?(Rails.env)) || ENV["RAILS_ENV"] || ENV["RACK_ENV"] } DEFAULT_ENV = -> { RAILS_ENV.call || "default_env" } # Establishes the connection to the database. Accepts a hash as input where |