nf5ufg
Last Updated: February 25, 2016
·
517
· webcoderph

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 :)

Say Thanks
Respond

1 Response
Add your response

8499
4693d7cfa88635d430c0de9a92f8dd84

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 ·