Rails generates a controller template for an existing resource?

I used generate scaffold

to set up basic RESTful actions, however I want to extend the actions to include something like "purchase". Is there a way to use the command line to generate the template (stub functions in the controller file and the updated route file?)?

As far as I can tell, generate controller

either wipes or leaves the existing file - there is no good way to merge them.

+3


source to share


1 answer


Not the default. However, understand that in Rails 3, configuring generators is not very difficult. See Creating and Customizing Rails Generators and Templates, and Bates' screencast on Generators in Rails 3 .



As for your second "question", that's right - the file is being overwritten or overwritten.

+5


source







All Articles