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
Merge pull request #18196 from PavelPenkov/rails_env_instead_of_rails

Check for Rails.env instead of Rails