What is the difference between "rails s" and "bundle exec rails s"?

What is the difference between rails sand bundle exec rails s? People seem to say which is bundle exec rails sbetter, but why? Meanwhile, this post speaks rails sbetter.

What is it?

+14
source share
3 answers

Sometimes, when you install a gem, it also has an executable / binary file. These include: rails, rake, rspec, pry, etc. However, when you have several versions of gem installed, you will have several versions of these executables sitting around. Therefore, if you want to execute one of these binaries for a given rails application, you may need to eliminate which executable you want - for example, for rake v10.1 or for rake v10.2. Since the answer to this can be found by the version of the gem that you have in your Gemfile.lock file (which is created by the binder), bundler provides a command to execute the binary file based on the version specified in the current Gemfile project. Castle. This team bundle exec <command>.

, bundle exec <command>, , ( , , Gemfile. ). - rails. , , rails, - , . , , rails.

, , :

rails server
rails console
bundle exec <some command that isn't rails>
+17

bundle exec , Gemfile.

rails, rake, .

+3

http://bundler.io/v1.5/rails3.html - Rails 3 comes with support baked with the package

+1
source

All Articles