开发者

Naming convention Rails

I read that Rails开发者_如何学JAVA follows some naming conventions, model name should be singular and controller name should be plural.

I have a model called body and i would like to know how am i supposed to name my controller's name -- should it be 'bodies' or 'bodys'??

Thanks for for any suggestion provided ;)

Sorry for this newbie question


to be precise your model should be called 'Body' (more of a Ruby thing to capitalize class names). ActiveRecord will automagically look in the SQL table called 'bodies' for any database interaction (create, update, delete).

Your controller will be called BodiesController in a file app/controllers/bodies_controller.rb.


following conventions bodies

class BodiesController
end


It should be bodies_controller. Bodys - something from children wear stuff =)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜