how can I get what enviornment is currently running from a controller?.. like development, test, production, etc. thanks.. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''d like to know this also. I need to know how force a rake task to pick up an environment other than ''production'' on my production host. I renamed my environment to something more specific, but "rake db:migrate" always uses the configuration under the "production" environment... On Jul 15, 2:00 pm, Aaron Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> how can I get what enviornment is currently running from a controller?.. > like development, test, production, etc. > > thanks.. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah, google actually had the answer to my question: rake db:migrate RAILS_ENV=my_production_env On Jul 15, 2:41 pm, zaven <gza...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''d like to know this also. I need to know how force a rake task to > pick up an environment other than ''production'' on my production host. > I renamed my environment to something more specific, but "rake > db:migrate" always uses the configuration under the "production" > environment... > > On Jul 15, 2:00 pm, Aaron Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > how can I get what enviornment is currently running from a controller?.. > > like development, test, production, etc. > > > thanks.. > > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
zaven wrote:> Ah, google actually had the answer to my question: > rake db:migrate RAILS_ENV=my_production_envI''m looking to find out how you access this in a controller. is it still RAILS_ENV? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
if you take a look at your rails gem. in rails/lib/initializer.rb, line 12-ish, there''s the following; RAILS_ENV = (ENV[''RAILS_ENV''] || ''development'').dup unless defined?(RAILS_ENV) So, indeed, calling RAILS_ENV from anywhere inside you app will return the environment. Aaron Smith wrote:> zaven wrote: >> Ah, google actually had the answer to my question: >> rake db:migrate RAILS_ENV=my_production_env > > I''m looking to find out how you access this in a controller. is it still > RAILS_ENV?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---