Browse files

Fix environment check for old versions of Rails

In some versions of Rails, the Rails module exists but the env method on
it does not. Confirm that the Rails module exists _and_ responds to :env
before calling Rails.env instead of RAILS_ENV.
  • Loading branch information...
jrdioko committed Dec 14, 2010
1 parent de1b821 commit 7da36391c15222a1e1b58c1687089a01c61b0e3f
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/sanitize_email/custom_environments.rb
@@ -13,7 +13,7 @@ def self.included(base)
module ClassMethods
def consider_local?
- local_environments.include?(defined?(Rails) ? Rails.env : RAILS_ENV)
+ local_environments.include?(defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : RAILS_ENV)

0 comments on commit 7da3639

Please sign in to comment.