Rails quick tip: generate and destroy

Rails generators are often known to be a one way street. Often people new to
rails think if they generate the wrong thing they are stuck. Not true! So here
we go, happens to me all the time:

$ rails g controller ReportsController index

Oh right generate just takes the name without the extension. No need to hunt
down the generated files:

$ rails d controller ReportsController index
$ rails g controller Reports index

Just run d for destroy and generate again. Just thought to point this out!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.