加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:29:41 所属栏目:百科 来源:网络整理
导读:在rails 3中,rails会调用bundler,这样你就不需要在你的应用程序Gemfile环境中运行bundle exec rails或者运行rails所需的bundle exec吗? 更新 据了解,由于rake版本不同,应该在rake任务之前使用bundle exec.有关详细信息,请参见http://railsapps.github.com/i
在rails 3中,rails会调用bundler,这样你就不需要在你的应用程序Gemfile环境中运行bundle exec rails或者运行rails所需的bundle exec吗?

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

rails s
rails server
rails c
rails console

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

解决方法

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

It’s good practice to use the command bundle exec rake instead of rake
so you’ll use the version of Rake specified in your gemfile (or a
dependency specified in the Gemfile.lock file) instead of the default
version. For example,instead of rake db:migrate,run bundle exec rake
db: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 exec
rake instead of rake.

引用自:http://railsapps.github.com/installing-rails-3-1.html

看起来与rails命令相反:

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读