Rails server does not take in account the production and still used development db
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=productionBut after have restart apache server I can see that rails use the development db and not the production while before it has used it.
I don't really understand what can cause this. So i really appreciate some help.
Thanks in advance.
Try:
env RAILS_ENV=production rake db:migrate
You can also add the following line to your $HOME/.bash_profile
:
export RAILS_ENV=production
I found my problem. In apache sites configuration I had RailsEnv development instead of production. But now I have another problem: rails does not start due to
* 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.
精彩评论