rails s or bundle exec rails s

后端 未结 2 480
生来不讨喜
生来不讨喜 2021-01-05 07:01

In rails 3 does rails s invoke bundler so that you don\'t need to do bundle exec rails s or is bundle exec required to run rails

相关标签:
2条回答
  • 2021-01-05 07:42

    You should get this behavior in Rail >= 3.1 however you need to be careful because you may be using an older version of 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.

    Quoted from: http://railsapps.github.com/installing-rails-3-1.html

    It looks like the opposite it true for the rails command:

    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.

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

    0 讨论(0)
  • 2021-01-05 07:47

    http://bundler.io/v1.5/rails3.html - "Rails 3 comes with baked in support with bundler...Bundler is transparently managing your dependencies!" So just run the server with

    rails server
    
    0 讨论(0)
提交回复
热议问题