I was wondering what the best practice is for determining whether you’re
rails app is on a qa server or on the production server.
Here’s the scenario:
I have some google analytics scripts that I want to be activated only
for
the production server. I have a QA server which I run in production
mode
for testing purposes so I can’t use the RAILS_ENV as the test. I was
thinking of just setting another ENV variable, but don’t know if that’s
the
best way… Is there a better way?
thanks,
a
–
Andrew S.
Andrew S. wrote:
I was wondering what the best practice is for determining whether you’re
rails app is on a qa server or on the production server.
Here’s the scenario:
I have some google analytics scripts that I want to be activated only for
the production server. I have a QA server which I run in production mode
for testing purposes so I can’t use the RAILS_ENV as the test. I was
thinking of just setting another ENV variable, but don’t know if that’s the
best way… Is there a better way?
Well if the hostnames are different you can just do something like:
hostname = hostname
if hostname == “<prod_machine>”
…
elsif hostname == “<qa_machine>”
…
end
–
Michael W.
Are your tests all coming from localhost? If so, you can test for
that using @controller.local_request?.