I tried using
logger.info "Rails Environment #{RAILS.env}"
but I’m getting an error:
uninitialized constant ApplicationController::RAILS
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
Rails.envinstead ofRAILS.env. So, that would beRails interpretes
RAILSas a constant. That is why there’s an ‘uninitialized constant’ error.I remember deprecation warnings when using
RAILS_ROOTorRAILS_ENV. Then they got yanked (no idea which version). Now, these are interpreted as constants. So,Rails.rootandRails.envare used instead – new ones are available in both Rails 2 and 3.May be you confused
RAILS.envwithRAILS_ENV. But, none of these two function now.