Form Validation with 2 models on form. Nubee Question

I have one form in which i enter Person data and Employee Data. A Person
and Employee model are used. I am using a legacy schema, so this is

How do i use save the data while using rails form validation?? I only
want both models to save if they both save.

Controller :

This odviously doesnt work:

def create_employee_and_person
employee =[:employee])
person =[:person])
employee.person = person

if and

Any help would be greately appreciated

I have found the answer here :

I need to check that each model is valid :

if model1.valid? and model2.valid?

Chris-45 wrote:

This odviously doesnt work:
Any help would be greately appreciated
I’d use a transaction spanning both updates.

View this message in context:
Sent from the RubyOnRails Users forum at

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs