From 290e8e117fd33189fec25d13b37e686b27247ad1 Mon Sep 17 00:00:00 2001 From: Pavel Penkov Date: Thu, 25 Dec 2014 16:21:20 +0300 Subject: [PATCH] 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 --- activerecord/lib/active_record/connection_handling.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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