Rails - one form, validation in two models

I have a form for the registration of new users. In the form are these inputs:

  • name (model_a)
  • age (model_a)
  • email (model_a)
  • icq (model_b)
  • skype (model_b)

All fields are required. The first 3 fields are in model_a and the last two in model_b. In both models I have already prepared validation rules.

It should work this way: User make registration and into the table model_a will be saved first 3 fields, into the table model_b last two fields.

But how to set up the form this way?


Take a look at Nested forms


Need Your Help

routing NoSQL and SQL backed fields in a single django Model

sql django django-models nosql

Is it possible to route fields in a single Model to different databases NoSQL and SQL? If not are there design that emulate that?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.