7

I am new to RoR and am starting on the guide at http://guides.rubyonrails.org/getting_started.html .

When I run the command bin/rails db:migrate, I get the error command db:migrate not recognized

But I am able to run the command bin/rake db:migrate without any issues.

My question is : is there any difference between the two or can I just rest easy and use rake? Thanks!

3 Answers 3

18

It depends on version of Rails. Before Rails 5.0 it was

rake db:migrate

Starting from Rails 5.0 it is

rails db:migrate

From changelog:

One Rails Command instead of the split-brain setup between rake and rails, so now it’s bin/rails db:migrate instead of bin/rake db:migrate

See changelog for full list of changes in Rails 5.

Sign up to request clarification or add additional context in comments.

Comments

4

Rails is framework.

Rake is a standalone Ruby utility that replaces the Unix utility ‘make’, and uses a ‘Rakefile’ and .rake files to build up a list of tasks. In Rails, Rake is used for common administration tasks, especially sophisticated ones that build off of each other.”

You can view more : https://www.tutorialspoint.com/ruby-on-rails/rails-and-rake.htm

Comments

2

Which version of rails gem are you using? In rails 5 (the guide you linked is for rails 5) we use rails command for everything. Before rails 5 we used rake for db commands.

1 Comment

I am using rails 4.2.5.. hm I should update my rails version then.. thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.