Form for several objects

Hello, I have an application I did using RoR 1.1.6, now I wanna
migrate it to 2.0.2 but I found a problem. Before I had a form like
this:

<%= start_form_tag :action => ‘update’, :id => @user %>
<%= error_messages_for ‘team’ %>
<%= error_messages_for ‘user_detail’ %>
<%= error_messages_for ‘user’ %>

Team name
<%= text_field 'team', :name, :size => 40 %>

Name
<%= text_field 'user_detail', :name, :size => 40 %>

Surname
<%= text_field 'user_detail', :surname, :size => 40 %>

e-mail
<%= text_field 'user_detail', :email, :size => 40 %>

Confirm e-mail
<%= text_field 'user_detail', :email_confirmation, :size => 40 %>

Username
<%= text_field 'user', :username, :size => 40 %>

Password
<%= password_field 'user', :password, :size => 40 %>

Confirm password
<%= password_field 'user', :password_confirmation, :size => 40 %>

<%= submit_tag ‘Edit’ %>
<%= end_form_tag %>

Now, changing the deprecated tag to form_for I can only reference
attributes for User class, but not for Team and UserDetail classes.

In my controller I receive three hashes and I could do this:

@user = User.new(params[:user])
@user_detail = UserDetail.new(params[:user_detail])
@team = Team.new(params[:team])
@user.team = @team
@user.user_detail = @user_detail

How could I do that now?

Well, I think I did a mistake, I have to use form_tag instead
form_for :). Isn’t it?

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