Check for existence of Rails before using Rails.env