rails/rails — pull request #18196 by PavelPenkov (2014-12-25 13:49:03+00:00)
Title: 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

To reproduce:
```
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE

system 'bundle'
end

require 'bundler'
Bundler.setup(:default)

require 'active_record'
require 'action_mailer'
require 'minitest/autorun'
require 'logger'

class TestMailer < ActionMailer::Base
end

class BugTest < Minitest::Test
def test_establish_connection
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') # => NoMethodError: undefined method `env' for Rails:Module
end
end
```