0

Yep fail... I messed things up how do I kill a model and migration so I can start it all over. I tried to get it to work with db:drop db:create db:migrate db:reset... can I just delete the model file and create a new one nothing seems to work.

Rails 5b3 ruby 2.3

2
  • And the question is? Commented Mar 18, 2016 at 5:31
  • and the question is answered below. rails d model "model name" Commented Mar 18, 2016 at 5:33

1 Answer 1

1

The best way I follow to delete a model is, first run:

rake db:migrate:status

and if you are on rails 5 I think the command would be:

rails db:migrate:status

So this will show the status of your migration. If the migration is up then run:

rails db:migrate:down VERSION=version_no

or

rake db:migrate:down VERSION=version_no

Then you can safely destroy the model:

rails d model ModelName

So this will safely delete your model and migration files.

Hope this helps.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.