Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 323
Robstaa Avatar asked Apr 18 '26 05:04

Robstaa


2 Answers

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.

like image 81
David Weber Avatar answered Apr 20 '26 12:04

David Weber


rails db:migrate vs bundle exec rake db:migrate

Internally rails is proxying commands to rake.

See this link

like image 32
Prince Bansal Avatar answered Apr 20 '26 10:04

Prince Bansal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!