Scaffold in rails 2.0 - more info required

Hi Guys, this is my first time posting a question in this group… so
you guessed right, i’m a noob (although I have programmed a bit in
other languages - mostly Java)…

anyway, it goes back to that classic first problem about the scaffold
in rails 2.0 where everybody does this tutorial and it screws them up
because it’s different than in rails 1.x … well I pretty much got my
head around that one, and it’s sorted… but now I’d like to know
more…

every single solution I’ve read tells me to use:

“script/generate scaffold Book title:string description:text”,

and then migrate…to create the model, controller, and database
pretty much all at once …

but the problem I have is that I can’t find a reference that shows me
definitively how to handle the data types: e.g. how do I set a field
to ‘NOT NULL’ from the scaffold command… how does it handle other
data types such as integers and dates… and what other options does
it provide (e.g. can you name your controller)??..

What i’d really like to know is how much control does it give you,
particularly over your database, and how precise can you be with the
scaffold command alone… does it usually require editing of the
database afterwards??.. I really just need a reference…

any info, or links to relevant info appreciated…

much thanks and apologies for my noobness :slight_smile:

Paul

On Jun 10, 1:54 am, Nellboy [email protected] wrote:

to ‘NOT NULL’ from the scaffold command… how does it handle other
data types such as integers and dates… and what other options does
it provide (e.g. can you name your controller)??..

scaffold allows you to pick the datatype but that’s pretty much it.
For anything else, edit the migration file (before you run rake
db:migrate). if you run the scaffold generator with no arguments it
should print out a usage summary

Fred

Yeah, what Fred said…

Just look at the generator as a secretary who can type all the “vanilla”
code for you, then edit the migration to add the specifics…

I need longtext for my notes fields, but the scaffold just uses text…
so I always edit the migrations after they’re generated.

But listing your fields on the generate command does get those fields
auto-populated into the views, letting the “secretary” do more of your
typing for you (One of these days I need to revamp the generator to
output haml for me, then I’ll be really happy).