Ruby on Rails plural (controller) and singular (model) convention - explanation
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As per Ruby on Rails convention, controller names get pluralized while model names are singular. Example : a Users controller, but a User model. rails generate controller Users rails generate model User name:string email:string Now open migration file class CreateUsers Here table name is plural (users). So my question is - Why table name is plural (users) even though the model name is singular (User)? 回答1: Ruby on Rails follow linguistic convention . That means a model represents a single user, whereas a database table consists of many users