rails g scaffold for existing model and DB table

不羁的心 提交于 2019-12-23 07:16:16

问题


I would like to create a structure with rails g scaffold Article, but I have already created the table Articles and model Articles.

Is there any way to do that?


回答1:


rails generate scaffold_controller Article




回答2:


Use rails generate scaffold_controller Article with parameters, example:

rails g scaffold_controller Article title:string body:text

Create views with attributes in tables



来源:https://stackoverflow.com/questions/9808668/rails-g-scaffold-for-existing-model-and-db-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!