# Form for several objects

**URL:** <https://www.ruby-forum.com/t/form-for-several-objects/124811>\
**Category:** Rails\
**Created:** [January 2, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/form-for-several-objects/124811 "2008-01-02T20:34:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@eyp](https://www.ruby-forum.com/u/eyp)\
**Post date:** [January 2, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/form-for-several-objects/124811/1 "2008-01-02T20:34:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![eyp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@eyp](https://www.ruby-forum.com/u/eyp)\
**Post date:** [January 2, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/form-for-several-objects/124811/2 "2008-01-02T20:42:09Z")

</div>

Well, I think I did a mistake, I have to use form\_tag instead  
form\_for :). Isn’t it?
