Search code examples
ruby-on-railsrubybundler

Bundle exec rake versus rails


What is the difference between for example using

rails db:migrate

and

bundle exec rake db:migrate

when using the rails framework? It seems to do the same for me...


Solution

  • Two fold. As of rails 5 you can substitute rails and rake for db:migrate. What you are really changing is adding bundle exec which is telling it to execute the rake from the application's bundler instead of your platform bundler.

    For instance, you have bundler v15 on your mac, and bundler v12 on the application. bundle exec rake will use bundler v12, but rake will use bundler v15.