Gregory Grimaux
2010-Nov-30 16:29 UTC
Rails server does not take in account the production and still used development db
0 down vote favorite Hi, since several days I have this problem: For a few days it has worked and now I can''t do it works again. I setup a rails server on ubuntu with apache-2. I used a git repository to get all new change. After I run sudo rake db:migrate RAILS_ENV=production But after have restart apache server I can see that rails use the development db and not the production while before it has used it. MORE INFO: While I''m trying to understand the problem I note something: When I execute rake db:migrate RAILS_ENV=production I can see that it create me the production db. But if I add new value in db I can see it still used development. I''m continuing my search on google :D. But if someone knows the answer I don''t really understand what can cause this. So i really appreciate some help. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Nov-30 16:44 UTC
Re: Rails server does not take in account the production and still used development db
Gregory Grimaux wrote in post #965148:> 0 down vote favorite > > > Hi, since several days I have this problem: > > For a few days it has worked and now I can''t do it works again. I setup > a rails server on ubuntu with apache-2. I used a git repository to get > all new change. After I run > sudo rake db:migrate RAILS_ENV=productionYou shouldn''t be using sudo for that.> > But after have restart apache server I can see that rails use the > development db and not the production while before it has used it.Then you have not set your RAILS_ENV environment variable correctly. You can usually do that in the Apache config file. I assume you''re using Passenger (and if not, you should). If I remember correctly, there is info in the Passenger docs on how to do this.> > MORE INFO: > While I''m trying to understand the problem I note something: When I > execute rake db:migrate RAILS_ENV=production I can see that it create me > the production db.Right, because RAILS_ENV=production puts you in the production environment -- for that task only.> But if I add new value in db I can see it still used > development. I''m continuing my search on google :D. But if someone knows > the answer > > I don''t really understand what can cause this. So i really appreciate > some help.Simple: as I explained above, environment variables are not being set correctly. When you specify an environment variable on the command line, it is only used for that command. Please gain a better understanding of how environment variable work in *nix. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gregory Grimaux
2010-Dec-01 07:38 UTC
Re: Rails server does not take in account the production and still used development db
Marnen Laibow-Koser wrote in post #965154:> Gregory Grimaux wrote in post #965148: >> 0 down vote favorite >> >> >> Hi, since several days I have this problem: >> >> For a few days it has worked and now I can''t do it works again. I setup >> a rails server on ubuntu with apache-2. I used a git repository to get >> all new change. After I run >> sudo rake db:migrate RAILS_ENV=production > > You shouldn''t be using sudo for that. >OK I will not used sudo in future.>> >> But after have restart apache server I can see that rails use the >> development db and not the production while before it has used it. > > Then you have not set your RAILS_ENV environment variable correctly. > You can usually do that in the Apache config file. > > I assume you''re using Passenger (and if not, you should). If I remember > correctly, there is info in the Passenger docs on how to do this. >>I''m using passenger with apache2. In my sites I set RailsEnv production So I think it should be OK.>> MORE INFO: >> While I''m trying to understand the problem I note something: When I >> execute rake db:migrate RAILS_ENV=production I can see that it create me >> the production db. > > Right, because RAILS_ENV=production puts you in the production > environment -- for that task only. > >> But if I add new value in db I can see it still used >> development. I''m continuing my search on google :D. But if someone knows >> the answer >> >> I don''t really understand what can cause this. So i really appreciate >> some help. > > Simple: as I explained above, environment variables are not being set > correctly. When you specify an environment variable on the command > line, it is only used for that command. > > Please gain a better understanding of how environment variable work in > *nix.I''m sorry I don''t understand what you mean by *nix maybe you''re talking about nginx> > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Vladimir Rybas
2010-Dec-01 08:02 UTC
Re: Re: Rails server does not take in account the production and still used development db
> I''m sorry I don''t understand what you mean by *nix maybe you''re talking > about nginxHe is talking about UNIX dude On Wed, Dec 1, 2010 at 10:38 AM, Gregory Grimaux <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Marnen Laibow-Koser wrote in post #965154: >> Gregory Grimaux wrote in post #965148: >>> 0 down vote favorite >>> >>> >>> Hi, since several days I have this problem: >>> >>> For a few days it has worked and now I can''t do it works again. I setup >>> a rails server on ubuntu with apache-2. I used a git repository to get >>> all new change. After I run >>> sudo rake db:migrate RAILS_ENV=production >> >> You shouldn''t be using sudo for that. >> > OK I will not used sudo in future. >>> >>> But after have restart apache server I can see that rails use the >>> development db and not the production while before it has used it. >> >> Then you have not set your RAILS_ENV environment variable correctly. >> You can usually do that in the Apache config file. >> >> I assume you''re using Passenger (and if not, you should). If I remember >> correctly, there is info in the Passenger docs on how to do this. >>> > > I''m using passenger with apache2. In my sites I set > RailsEnv production > > So I think it should be OK. > >>> MORE INFO: >>> While I''m trying to understand the problem I note something: When I >>> execute rake db:migrate RAILS_ENV=production I can see that it create me >>> the production db. >> >> Right, because RAILS_ENV=production puts you in the production >> environment -- for that task only. >> >>> But if I add new value in db I can see it still used >>> development. I''m continuing my search on google :D. But if someone knows >>> the answer >>> >>> I don''t really understand what can cause this. So i really appreciate >>> some help. >> >> Simple: as I explained above, environment variables are not being set >> correctly. When you specify an environment variable on the command >> line, it is only used for that command. >> >> Please gain a better understanding of how environment variable work in >> *nix. > > I''m sorry I don''t understand what you mean by *nix maybe you''re talking > about nginx >> >> Best, >> -- >> Marnen Laibow-Koser >> http://www.marnen.org >> marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Gregory Grimaux
2010-Dec-01 08:24 UTC
Re: Re: Rails server does not take in account the production and still used development db
Vladimir Rybas wrote in post #965318:>> I''m sorry I don''t understand what you mean by *nix maybe you''re talking >> about nginx > > He is talking about UNIX dudeOK :D Sorry. I found my error. I had two site configured in my apache configuration. One with rails= prod and one with rails = dev. And of course it was using rails = dev. So I think I found my problem. I will let a message to confirm. I need to made some fix on server now since it does not start correctly. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gregory Grimaux
2010-Dec-01 09:08 UTC
Re: Re: Rails server does not take in account the production and still used development db
Gregory Grimaux wrote in post #965320:> Vladimir Rybas wrote in post #965318: >>> I''m sorry I don''t understand what you mean by *nix maybe you''re talking >>> about nginx >> >> He is talking about UNIX dude > > OK :D Sorry. I found my error. I had two site configured in my apache > configuration. One with rails= prod and one with rails = dev. And of > course it was using rails = dev. So I think I found my problem. I will > let a message to confirm. I need to made some fix on server now since it > does not start correctly.Now I have a another problem. It works in my development environment but no in production. *** Exception ArgumentError in PhusionPassenger::Railz::ApplicationSpawner (No association found for name `machines''. Has it been defined yet?) (process 16052): from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:245:in `accepts_nested_attributes_for'' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in `each'' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in `accepts_nested_attributes_for'' from /home/et1/wip3/sophia/app/models/machines_operatingsystem.rb:2 But I don''t understand why. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Gregory Grimaux
2010-Dec-01 10:03 UTC
Re: Re: Rails server does not take in account the production and still used development db
Gregory Grimaux wrote in post #965329:> Gregory Grimaux wrote in post #965320: >> Vladimir Rybas wrote in post #965318: >>>> I''m sorry I don''t understand what you mean by *nix maybe you''re talking >>>> about nginx >>> >>> He is talking about UNIX dude >> >> OK :D Sorry. I found my error. I had two site configured in my apache >> configuration. One with rails= prod and one with rails = dev. And of >> course it was using rails = dev. So I think I found my problem. I will >> let a message to confirm. I need to made some fix on server now since it >> does not start correctly. > > > > Now I have a another problem. It works in my development environment but > no in production. > > *** Exception ArgumentError in > PhusionPassenger::Railz::ApplicationSpawner (No association found for > name `machines''. Has it been defined yet?) (process 16052): > from >/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:245:in> `accepts_nested_attributes_for'' > from >/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in> `each'' > from >/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in> `accepts_nested_attributes_for'' > from /home/et1/wip3/sophia/app/models/machines_operatingsystem.rb:2 > > > But I don''t understand why.Error found my fault. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.