在rails 3中,rails s是为了不需要执行bundle exec rails s,还是需要bundle exec在应用程序Gemfile环境中运行rails s?
更新理解在rake任务之前应该使用bundle exec,因为rake版本不同。有关更多详细信息,请参阅http://railsapps.github.com/installing-rails-3-1.html。这个问题是关于rails脚本的,比如:
rails s
rails server
rails c
rails console^应该在这些rails脚本之前使用bundle exec,还是由rails命令调用bundler?
发布于 2012-07-23 17:16:16
但是,您应该在Rail >= 3.1中获得这种行为,但是您需要小心,因为您可能使用的是rake的旧版本:
使用命令包exec代替rake是一种很好的做法,因此您将使用use文件中指定的rake版本(或Gemfile.lock文件中指定的依赖项)代替默认版本。例如,运行bundle exec rake :migrate,而不是rake :migrate。 您需要知道的是:在安装Rails 3.1之前,请确保在使用Rake 0.9.2.2 (或更新版本)使用gem更新rake。并使用捆绑执行rake代替rake。
引用自:http://railsapps.github.com/installing-rails-3-1.html
与rails命令相反,rails命令也是如此:
不要在rails命令之前运行bundle exec,rails已经通过Gemfile检查了Bundler的存在,并根据它设置了所有东西,而不需要bundle exec的开销。rails命令是该规则的唯一例外。
引用自:https://www.wyeworks.com/blog/2011/12/27/bundle-exec-rails-executes-bundler-setup-3-times/
https://stackoverflow.com/questions/11617085
复制相似问题