Balaji Rajagopalan wrote:
> Hi
>   Im using the 5 tables+5 views+one model+one controller.so i can't
> understand  and give any idea
> 
> balaji

Generally for Rails, 1 db table == 1 Rails model.

If you're trying to do this with a single model, I assume that you'll 
have to:

1. construct that model so it contains equivalents for all the fields 
from all the tables.
2. Pass this model from view to view, editing some fields, and keeping 
the rest as hidden fields on each form. Like form1 shows fields 1 and 2, 
hides fields 3 through 10. Form 2 shows fields 3 and 4, hides 1, 2, 5 
through 10, etc.
3. the controller has to know which form submitted so it knows what to 
do next... go to the next form, or try to save the data. A variable 
stored in a hidden field should suffice for that, @current_step or 
something like that.
4. When you finally submit from view 5 and go to save, extract the 
fields for the parent table and save that record. Re-read that record to 
get its id, and put that in the parent id field for each of the sets of 
fields you have to save to your child tables. And wrap it all in a 
transaction so you can rollback if the third or fourth model fails 
validation.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to