I am playing with the scaffold feature of rails in Netbeans 6.5. Right click->Generate gives me a menu that allows me to create the scaffold but asks for "attribute pairs". I have some tables with quite a few columns and would rather have the scaffolded pages include them all instead of specifying each one individually. Does anyone know how to do this within Netbeans?
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.
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.
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.
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.