Last Updated: February 25, 2016
·
2.676K
· maynard cabalitan

Rails Destroy

Sometimes, you generate controller or model that you don't need. You want to reverse the things you've generated. Instead of deleting files manually one by one. Rails has a command for that.
here's the codes.

rails destroy controller <controller name>
rails destroy model <model name>
rails destroy scaffold <model name>

Enjoy :)

1 Response
Add your response

I was just talking about this the other day to a co-worker who is starting with Rails. He used to delete file by file when mistyping a field or type in the scaffold. I will share this with him so he can remember! :) Thanks for sharing.

There is another useful option called --pretend that previews what it would actually generate but doesn't create anything.

over 1 year ago ·