开发者

Scaffold only a subset of methods in controller

开发者 https://www.devze.com 2023-03-24 16:07 出处:网络
Is there a way to generate a subset of methods in the controller using scaffold instead of the r开发者_如何学Cegular scaffold?

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

精彩评论

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