从RAILS_ROOT外部运行rake任务

Ana*_*hah 4 rake ruby-on-rails task

我的RAILS_ROOT是/ usr/local/www/application /

如果我从RAILS_ROOT中运行'rake db:migrate RAILS_ENV = production',它可以正常工作.

但是我似乎找不到从RAILS_ROOT外部运行相同命令的方法.

Swa*_*and 12

尝试:

rake -f $RAILS_ROOT/Rakefile db:migrate RAILS_ENV=production
# Assuming you set the environment variable. 
# Else, just replace $RAILS_ROOT by actual value
Run Code Online (Sandbox Code Playgroud)