$ RAILS_ENV=dev bundle exec rails c
Loading dev environment (Rails 4.0.4)
[1] pry(main)> exit
$ bundle exec rails c RAILS_ENV=dev
error occur...
Run Code Online (Sandbox Code Playgroud)
这两个rails启动命令有什么区别?
是的,它们是不同的,结果也显示了!
RAILS_ENV=dev bundle exec rails c将设置变量RAILS_ENV到dev其之前变为可用bundle exec rails c时执行.因此,bundle exec rails c将看到该变量并使用它.
with bundle exec rails c RAILS_ENV=dev,RAILS_ENV=dev成为一个参数bundle exec rails c,因为RAILS_ENV=dev文字被假定为环境,因为rails cif提供的第一个参数是环境.该错误可能是因为您没有名称的环境RAILS_ENV=dev.
要成功执行第二个命令,您可以执行以下操作: bundle exec rails c dev.
| 归档时间: |
|
| 查看次数: |
34 次 |
| 最近记录: |