Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can 'rails g controller' generate restful routes?

Is there a way, using rails generators, to create a controller with RESTful routes?

Generating a controller and specifying the action name creates a controller and adds a route to config/routes.rb, but create is a get:

$ rails g controller foos new create
  create  app/controllers/foos_controller.rb
   route  get "foos/create"
   ...

I'd prefer to see route post "foos", but don't see anything useful in rails g controller --help

like image 753
rthbound Avatar asked Sep 06 '25 08:09

rthbound


1 Answers

Try using rails generate scaffold_controller Foos

like image 87
Raghu Avatar answered Sep 08 '25 11:09

Raghu