Balancing On Rails

August 01, 2007

Removing a controller

Rails does a lot of automation to generate controllers etc. For an example if you are creating a controller, all you need to do is:

ruby script/generate controller some

This would generate a lot of things like

  • creates a director called some under views
  • creates a file called some_controller.rb under app/controllers directory.
  • creates a file called some_controller_test.rb test/functional directory.
  • creates a file called admin_helper.rb under app/helpers directory.

All this is fine. But let's say I created this controller and later I don't want this controller. I want to remove it. How do I remove it? Is there a automation command that would go through and remove the files for me?

Technorati tags: , ,

12 Comments:

  • At February 12, 2008 at 8:19 AM , OpenID marcushd said...

    ruby script/destroy controller some

     
  • At August 15, 2011 at 12:56 AM , Blogger www.blogspot.ibanta.com said...

    In rails 3 just do

    rails destroy controller controller_name views_name

    That's all.

     
  • At August 15, 2011 at 12:58 AM , Blogger www.blogspot.ibanta.com said...

    In rails 3

    rails destroy controller_name views_name

    That's all.

     
  • At December 25, 2011 at 9:20 PM , Blogger Mani Maran M said...

    In rails3.1, i just give the following and it deletes both controller and corresponding files including views.

    rails destroy controller controller_name

    Thanks,
    Mani

     
  • At February 17, 2012 at 6:04 PM , Anonymous Anonymous said...

    Had the same question, and this was my answer =)

     
  • At March 31, 2013 at 11:54 AM , Anonymous Anonymous said...

    Hello, i think that i saw you visited my site thus i came to “return the favor”.
    I am trying to find things to enhance my web site!I suppose its
    ok to use a few of your ideas!!

    Here is my webpage - 2006 honda s2000 for sale

     
  • At April 2, 2013 at 7:56 AM , Anonymous Anonymous said...

    Α rеsidentіal RΟ filter is mаԁe fгom a thin
    film composite membrane (TFM оr TFC),
    which іs made out of sheet polуmer and is comprіsed οf multiρle
    layers. The three leѵels of fіltration proсess within the
    devісe should be enοugh to put your woгriеs to rest.
    Website:.

    Мy wеb blοg; reverse osmosis water filter and fluoride

     
  • At April 9, 2013 at 12:45 AM , Anonymous Anonymous said...

    Thanks for the auspicious writeup. It actually was once a leisure account it.
    Glance advanced to more introduced agreeable from you! However, how could we keep up a correspondence?


    my website outward hound pet sling

     
  • At April 13, 2013 at 6:48 PM , Anonymous Anonymous said...

    This sticky gel forms a physical barrier between the outside and the inside
    of the body diet and thus weaken you completely. These are the things that
    many nutritionists and doctors believe lead to obesity and increase your risk of developing certain
    types of fat, above butter. Exercise Simplicity - When you first hear about exercise, the American Institute for Cancer Research don't make sense. MORE diet: Healthy Or A Hoax? Of salmon, pork loin or steak as a source of protein, and 55% as carbohydrate.

    Have a look at my blog post best way to lose weight

     
  • At May 4, 2013 at 7:14 PM , Anonymous Anonymous said...

    You can also have a similar effect on the young body and mind of harmful toxins.


    my blog post does body cleanse help lose weight

     
  • At May 22, 2013 at 4:33 AM , Anonymous Anonymous said...

    For example, the flow of water and add a Universal Colon Purify tablet and let it
    simmer for 10-15 minutes. These days people are able to feel much
    lighter and have a healthier outlook on life. Niacin and other B vitamin deficiencies
    are common in people who are already suffering from drug addiction and alcoholism
    into drug find boyfriend and a successful drug rehab program.
    Our bodies are constantly weighed down by them. If you are in a constant
    state of stress also puts them in a constant state of sickness.


    My web-site; web site

     
  • At June 16, 2013 at 1:55 PM , Anonymous Anonymous said...

    Sаved as a faνorіtе, I love уour webѕite!


    Fеel freе tо visit my ρаge losing weight after 50

     

Post a Comment

Subscribe to Post Comments [Atom]

<< Home