[Feature Proposal] pass http verbs when generating controller

Currently if we run rails g controller Posts new create it will consider create to be a GET action and generate a GET route and a view. I propose we add the possibility to pass the http verb in the generator (like rails g controller Posts new post:create patch:update delete:destroy) which will create a route with the correct http verb and skip creating a view unless it’s a GET action

Hey! How about letting the generator use the resources Keyword for all 7 CRUD actions? It’s a fair but more conventional isn’t it?

hmm, if we want all resources I’d say we can use scaffolding maybe I’m wrong but my understanding is that when we just generate a controller, it’s usually for the cases where we need more limited features

At the least it should be rails g controller Posts new create:post update:patch destroy:delete [action:verb …] to align with how migrations have column:type


1 Like