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 Stone --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrew Stone 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 Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Are your tests all coming from localhost? If so, you can test for that using @controller.local_request?. On Mar 9, 10:16 pm, "Andrew Stone" <stoneli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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? > > thanks, > a > > -- > Andrew Stone--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---