# Getting Rid of Accidental Controller

**URL:** <https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571>\
**Category:** Rails\
**Created:** [January 20, 2006, 10:13pm UTC](https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571 "2006-01-20T22:13:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [January 20, 2006, 10:13pm UTC](https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571/1 "2006-01-20T22:13:14Z")

</div>

I accidentally created a controller with the wrong name. Obviously I  
don’t want to have this useless controller hanging around - is there a  
prescribed way to delete the controller or can I just delete the  
controller file?

---

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [January 20, 2006, 10:22pm UTC](https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571/2 "2006-01-20T22:22:43Z")

</div>

from yesterday

not sure what you’ve done to get what you’ve got, but the destroy script  
will certainly help you clean up properly (i.e: it removes the tests and  
helpers and stuff)

e.g:

ruby script/destroy controller article

---

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [January 20, 2006, 10:54pm UTC](https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571/3 "2006-01-20T22:54:16Z")

</div>

Just delete the file. If you use the

ruby script/destroy controller MyController

command though, it will also get rid of your functional tests. And maybe  
a helper too and stuff.

Mark D. wrote:

> I accidentally created a controller with the wrong name. Obviously I  
> don’t want to have this useless controller hanging around - is there a  
> prescribed way to delete the controller or can I just delete the  
> controller file?

---

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [January 20, 2006, 11:27pm UTC](https://www.ruby-forum.com/t/getting-rid-of-accidental-controller/63571/4 "2006-01-20T23:27:10Z")

</div>

Thank you.
