How can I generate a scaffold for only specific action?
rails g scaffold user name create destroy (but its not working as expected, it create all 7 standard actions)
I only want to generate through scaffold command.
After looking into the docs and reading rails g scaffold --help and rails g scaffold_controller --help I come to the conclusion that what you want is not possible.
It makes some sense, since in Rails terms a scaffold controller is a RESTful controller, which implies that it creates those 7 standard actions so you can say resources :users in your routing file.
I think you just have to manually remove the unwanted actions, views and routing behaviour. Or perhaps better: just create everything from scratch or from a regular rails g controller index show-like command, and then fill in the blanks using copy/paste from some other scaffolded resource.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With