gpt4 book ai didi

ruby-on-rails-3 - rails s 或 bundle exec rails s

转载 作者:行者123 更新时间:2023-12-04 11:28:03 25 4
gpt4 key购买 nike

在 rails 3 中是 rails s调用 bundler,这样你就不需要做 bundle exec rails s或者是 bundle exec需要运行 rails s在您的应用程序 Gemfile 环境中?

更新
据了解,bundle exec由于不同的 rake 版本,应该在 rake 任务之前使用。见 http://railsapps.github.com/installing-rails-3-1.html更多细节。这个问题是关于 rails 脚本的,比如:

rails s
rails server
rails c
rails console

^应该 bundle exec在这些 rails 脚本之前使用,还是由 rails 命令调用 bundler?

最佳答案

您应该在 Rail >= 3.1 中获得这种行为,但是您需要小心,因为您可能使用的是旧版本的 rake:

It’s good practice to use the command bundle exec rake instead of rakeso you’ll use the version of Rake specified in your gemfile (or adependency specified in the Gemfile.lock file) instead of the defaultversion. For example, instead of rake db:migrate, run bundle exec rakedb:migrate.

What You Need to Know: Make sure you are using Rake 0.9.2.2 (or newer)with gem update rake before installing Rails 3.1. And use bundle execrake instead of rake.


引用自: http://railsapps.github.com/installing-rails-3-1.html
对于 rails 命令,它看起来正好相反:

don’t run bundle exec before rails command, rails already checks thepresence of Bundler through the Gemfile and sets up everythingaccording to it without the overhead of bundle exec. rails command isthe only exception to the rule.


引用自: https://www.wyeworks.com/blog/2011/12/27/bundle-exec-rails-executes-bundler-setup-3-times/

关于ruby-on-rails-3 - rails s 或 bundle exec rails s,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11617085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com