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