You are getting the following error because you already have a migration named create_posts
in your rails application.
invoke active_record Another migration is already named create_posts..... Use --force to remove the old migration file
So, what you need here is first remove the existing migration and then generate the scaffold.
rails d migration create_posts
rails generate scaffold post title:string body:text
Or
You could generate the scaffold using --force
option
rails generate scaffold post title:string body:text --force
EDIT
As per your comment:
I did that and then a whole bunch of code appears with the lines of code sating invoke...exist...identical.
It means that you already ran a scaffold
once for Post
successfully and you are trying to generate the scaffold again
.
I am not sure why you are doing that BUT identical
is not an error. Its just that Rails is telling you that you already have a particular file so I am not creating again.