Hi, I have the production version of my rails site hosted on a server. (I uncommented the line "ENV[''RAILS_ENV''] ||= ''production''" in the environment.rb file). I know it''s running in production mode because I can tell that the production database is being used and it''s the production log that''s being written to. But, whenever I try to "rake db:migrate" or "script/console", it''s the development database that gets migrated and the development environment that gets loaded into console --- unless I specify "RAILS_ENV=production". What''s up with that? I''ve never had that happen before. The hosting company says it''s nothing in their config (of course), so is there something in one of my files that could be doing that? Thanks, Greg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn
2008-Jun-16 16:41 UTC
Re: rake db:migrate and script/console in wrong environment
On Jun 16, 2008, at 12:24 PM, Greg B. wrote:> Hi, > > I have the production version of my rails site hosted on a server. (I > uncommented the line "ENV[''RAILS_ENV''] ||= ''production''" in the > environment.rb file). I know it''s running in production mode because I > can tell that the production database is being used and it''s the > production log that''s being written to. > > But, whenever I try to "rake db:migrate" or "script/console", it''s the > development database that gets migrated and the development > environment that gets loaded into console --- unless I specify > "RAILS_ENV=production". > > What''s up with that? I''ve never had that happen before. The hosting > company says it''s nothing in their config (of course), so is there > something in one of my files that could be doing that? > > Thanks, > GregYou could set RAILS_ENV=production in your login script. What do you see when you type: env into the shell. Does RAILS_ENV have a value? (equivalently: echo $RAILS_ENV) Otherwise, you can say: script/console production or give the setting with each command as you mentioned. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
RAILS_ENV is not listed when I type "env". I don''t see anything there that would force the development environment. Greg On Jun 16, 12:41 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Jun 16, 2008, at 12:24 PM, Greg B. wrote: > > > > > Hi, > > > I have the production version of my rails site hosted on a server. (I > > uncommented the line "ENV[''RAILS_ENV''] ||= ''production''" in the > > environment.rb file). I know it''s running in production mode because I > > can tell that the production database is being used and it''s the > > production log that''s being written to. > > > But, whenever I try to "rake db:migrate" or "script/console", it''s the > > development database that gets migrated and the development > > environment that gets loaded into console --- unless I specify > > "RAILS_ENV=production". > > > What''s up with that? I''ve never had that happen before. The hosting > > company says it''s nothing in their config (of course), so is there > > something in one of my files that could be doing that? > > > Thanks, > > Greg > > You could set RAILS_ENV=production in your login script. What do you > see when you type: > > env > > into the shell. Does RAILS_ENV have a value? (equivalently: echo > $RAILS_ENV) > > Otherwise, you can say: > script/console production > or give the setting with each command as you mentioned. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn
2008-Jun-16 18:06 UTC
Re: rake db:migrate and script/console in wrong environment
On Jun 16, 2008, at 1:13 PM, Greg B. wrote:> RAILS_ENV is not listed when I type "env". I don''t see anything there > that would force the development environment. > > GregThe development environment is the default when it isn''t set otherwise. Chances are that your startup sets RAILS_ENV (to production). -Rob> On Jun 16, 12:41 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> > wrote: >> On Jun 16, 2008, at 12:24 PM, Greg B. wrote: >> >> >> >>> Hi, >> >>> I have the production version of my rails site hosted on a server. >>> (I >>> uncommented the line "ENV[''RAILS_ENV''] ||= ''production''" in the >>> environment.rb file). I know it''s running in production mode >>> because I >>> can tell that the production database is being used and it''s the >>> production log that''s being written to. >> >>> But, whenever I try to "rake db:migrate" or "script/console", it''s >>> the >>> development database that gets migrated and the development >>> environment that gets loaded into console --- unless I specify >>> "RAILS_ENV=production". >> >>> What''s up with that? I''ve never had that happen before. The hosting >>> company says it''s nothing in their config (of course), so is there >>> something in one of my files that could be doing that? >> >>> Thanks, >>> Greg >> >> You could set RAILS_ENV=production in your login script. What do you >> see when you type: >> >> env >> >> into the shell. Does RAILS_ENV have a value? (equivalently: echo >> $RAILS_ENV) >> >> Otherwise, you can say: >> script/console production >> or give the setting with each command as you mentioned. >> >> -Rob >> >> Rob Biedenharn http://agileconsultingllc.com >> R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---