简体   繁体   中英

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...

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 .

rails db:migrate vs bundle exec rake db:migrate

Internally rails is proxying commands to rake.

See this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM