Generate a controller with all the RESTful functions

Barb picture Barb · Mar 23, 2010 · Viewed 92.2k times · Source

I am trying to generate a controller with all the RESTful actions stubbed. I had read at Wikibooks - Ruby on Rails that all I needed to do was to call the generator with the controller name and I would get just that. So, I ran script/generate rspec_controller Properties but got an empty controller.

Any other suggestions would be greatly appreciated.

Answer

Marcos Placona picture Marcos Placona · Mar 23, 2010

I don't know about an automated way of doing it, but if you do:

script/generate controller your_model_name_in_plural new create update edit destroy index show

All of them will be created for you

Update for Rails 4

rails g scaffold_controller Property