multiple models from one controller.

ikiini
Sun, 22 Apr 2007 23:24:54 -0000

Hey all,

I am new to Ruby on Rails and need some beyond basics help. I have a
the agile web dev with rails 2nd ed. And i have looked at a few
tutorials online. However none has covered real life webapps with
multiple tables in a DB where some depend on others. let me cut to the
chase. I have a app with 3 tables. 2 of the tables are directly
related meaning that i can''t insert into one with out inserting the
corresponding values into the other. now i have figure out with some
help from IRC how to do this. but now i have a problem. I need to have
validattion on both models before the inserts are made. what is
happening is that if validation passes on the 1st, that inserts then
the 2nd fails and that doesn''t insert. so right there i have a
problem. My question is how do i handle such a situation. Thanks for
the help

-B