开发者

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 r开发者_如何学Cegular scaffold?

For example: Only create new and show?

I am using rails 3, ruby 1.9.2

Thanks


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜