Immo
Immo

Reputation: 601

Scaffold only a subset of methods in controller

Is there a way to generate a subset of methods in the controller using scaffold instead of the regular scaffold?

For example: Only create new and show?

I am using rails 3, ruby 1.9.2

Thanks

Upvotes: 1

Views: 924

Answers (2)

cailinanne
cailinanne

Reputation: 8372

In plain Rails3, you can do this when you generate the controller:

rails generate controller Artists new create

So, you could just generate the model, and then the controller, and get the overall functionality you were looking for.

Upvotes: 1

Pete
Pete

Reputation: 18085

I do not think the default rails scaffold generator supports this in Rails 3.

However, this can be accomplished using the nifty-generators gem:

https://github.com/ryanb/nifty-generators

Upvotes: 2

Related Questions