Do you mean you want to scaffold the all the tables all at once? I think the script doesn't do that.
你的意思是你想一次性支架所有的桌子吗?我认为脚本不会这样做。
But you can indeed generate a table with all the required columns by specifying all the attribute pairs. I don't use Netbeans, sorry, but you could specify them on command line this way.
但是,您确实可以通过指定所有属性对来生成包含所有必需列的表。抱歉,我不使用Netbeans,但您可以通过这种方式在命令行中指定它们。
Each attribute pairs is a column in your table. For example, this command line
每个属性对都是表格中的一列。例如,此命令行
./script/generate scaffold blogpost title:string body:text
generates a controller, a model and some views with the name of blogpost. blogpost
would be your tablename, and title:string
is an attribute pair. For more attribute pair within the same table, just append them to the end, space delimited. Hopefully there's a menu you can do they same in Netbeans.
生成一个控制器,一个模型和一些名为blogpost的视图。 blogpost将是您的tablename,title:string是一个属性对。对于同一个表中的更多属性对,只需将它们附加到末尾,以空格分隔。希望有一个菜单,你可以在Netbeans中做同样的事情。
I hope this helps!
我希望这有帮助!
EDIT: Just saw a screenshot of the function in Netbeans. Under 'Model name' you can specify your table name. Under attribute pairs you can list all the columns in your table like shown above.
编辑:刚看到Netbeans中的功能截图。在“型号名称”下,您可以指定表名。在属性对下,您可以列出表格中的所有列,如上所示。
title:string body:text
If you are deciding to use Rails with tables that already exists, that's a more advanced topic because Rails impose a certain column names convention of it's own and it possibly means you are not going to comply with it.
如果您决定将Rails与已经存在的表一起使用,那么这是一个更高级的主题,因为Rails强加了它自己的某个列名约定,这可能意味着您不会遵守它。
Rails with Non-Rails Database Design - Stack Overflow
带有非Rails数据库设计的Rails - Stack Overflow