Ok… So I’ve been doing more reading after buying a few RoR books
now… I’ve got
my data models setup without any foreign keys between the tables (much
to my dismay).
What I’m wondering are the following :
-
should I be manually setting up the foreign keys by editing the
initial migration
stuff to add the missing “t.references :my_cool_object” or should
I be using the
scaffold generator for that when I create the 2nd and subsequent
tables --? I’m
ordering the creation of the tables to ensure the initial tables
are created first and
subsequent belongs_to and has_xxx are put in afterwards by hand –
I’m now
thinking I should probably have put xxx:references as part of the
scaffold generation
line when building the secondary set of tables to ensure the
proper “t:references”
were put in the migration area – will that ensure my foreign keys
are established
when I do the first “rake db::migrate”? -
If I’ve got tailored changes in either of the model files or in the
migrations area,
would the scaffolding blow those away if I re-do a piece of it
from the command line?
(e.g. will I lose my belongs_to and has_one/many associations in
the model files)? -
Where can I find the available list of commands for the scaffold
generator so I can make
proper use of it? I didn’t see much in the full rails API docs
but perhaps I overlooked it?
Thanks! I’m hoping I can put this data modeling behind me today and
move on to the
more entertaining parts (generating an app!).