Rails generate - "Could not find a generator"

I follow the Ruby on Rails guide by Michael Hartle. In section 6.3.1, I try to create a migration file to add the Password field to my user model. Here is the code I'm running:

rails generate add_passsword_digest_to_users password_digest:string 

but this causes an error: Could not find generator add_passsword_digest_to_users.

I used the rails generate command before and it worked great. I am not sure why I am having this problem.

version: Rails 3.2.8, ruby ​​1.9.3p194 (2012-04-20 version 35410) [x86_64-linux]

+6
source share
2 answers

Try:

 rails generate migration add_passsword_digest_to_users password_digest:string 

You just forgot migration , which is a generator to use for other arguments.

+10
source

You forgot to include migration in the team. You can just do

 rails generate migration add_passsword_digest_to_users password_digest:string 
0
source

Source: https://habr.com/ru/post/926996/


All Articles