# Newbie Help Please! Update 2 Tables with one form

**URL:** <https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948>\
**Category:** Rails\
**Created:** [January 29, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948 "2009-01-29T18:01:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanmctex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@seanmctex](https://www.ruby-forum.com/u/seanmctex)\
**Post date:** [January 29, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948/1 "2009-01-29T18:01:20Z")

</div>

I have a form:

\<% form\_tag :action =\> ‘create’ do %\>  
\<%= hidden\_field\_tag ‘plan’, params[:plan] %\>

 \<% fields\_for :account do |f| %\>

```
<%= f.text_field :name %>

  <%= f.text_field :domain %>.<%= AppConfig['base_domain'] %>
<% end %>

```

 \<% fields\_for :user do |f| %\> \<%= f.text\_field :login %\>  
 \<%= f.text\_field :eservice %\> PPL Eservice Login (If Known)  
 \<%= f.text\_field :first\_name %\>  
 \<%= f.text\_field :last\_name %\>  
 \<%= f.text\_field :email %\>  
 \<%= f.text\_field :contact\_number %\>  
 Password \<%= f.password\_field :password %\>  
 Password Confirmation \<%= f.password\_field :password\_confirmation %\> \<% end %\> 

I would like to only have the second part of the form and have the  
fields first\_name last\_name update the account table name and have  
login update the account table domain. Do you know how to do this?

Thank you,

Sean McGilvray

---

<div class="post-metadata">

**Author:** ![seanmctex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@seanmctex](https://www.ruby-forum.com/u/seanmctex)\
**Post date:** [January 29, 2009, 8:49pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948/2 "2009-01-29T20:49:29Z")

</div>

Your question doesn’t make enough sense. What are the exact models or  
table names that you want to update?

Sent from my iPhone

On 30/01/2009, at 4:01 AM, Sean M.  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![seanmctex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@seanmctex](https://www.ruby-forum.com/u/seanmctex)\
**Post date:** [January 29, 2009, 9:11pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948/3 "2009-01-29T21:11:49Z")

</div>

Julian L. wrote:

> Your question doesn’t make enough sense. What are the exact models or  
> table names that you want to update?
> 
> Sent from my iPhone
> 
> On 30/01/2009, at 4:01 AM, Sean M.  
> \<removed\_email\_address@domain.invalid

My tables are:

1. Users  
Field 1: login  
Field 2: eservice  
Field 3: first\_name  
Field 4: last\_name  
Field 5: email  
Field 6: contact\_number  
Field 7: password  
Field 8: Password Confirmation

2. Account  
Field 1: name  
Field 2: domain.\<%= AppConfig[‘base\_domain’] %\>

I want to only have the user part of the form filled out. When  
submitted have it update the users table and the account table. It  
should take the first\_name + last\_name fields from users and save them  
into the account table in the name field. Then I want it to take the  
users login and save it to the account table domain field. I am trying  
to not the user put the same information in twice for registration.

Thank you,

Sean McGilvray

---

<div class="post-metadata">

**Author:** ![seanmctex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@seanmctex](https://www.ruby-forum.com/u/seanmctex)\
**Post date:** [January 29, 2009, 9:22pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948/4 "2009-01-29T21:22:56Z")

</div>

That makes more sense. It’s much better when people take time to form  
their questions.

I have one question tho - how will you link the user to their account?

Anyway, in the destination action of  
The form - its target - you need to specify two “new” methods rather  
than just one. Let me know if you need more explanation

Sent from my iPhone

On 30/01/2009, at 7:11 AM, Sean M.  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![seanmctex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@seanmctex](https://www.ruby-forum.com/u/seanmctex)\
**Post date:** [January 29, 2009, 9:47pm UTC](https://www.ruby-forum.com/t/newbie-help-please-update-2-tables-with-one-form/158948/5 "2009-01-29T21:47:50Z")

</div>

Thank you for your reply and I will need some more explanation. They  
are  
linked through user\_id.

Thank you,

Sean McGilvray & Sarena Byers  
Director  
Identity Theft Specialist  
Pre-Paid Legal Service’s, Inc. NYSE:PPD  
Phone: 760-486-1019  
removed\_email\_address@domain.invalid  
[http://www.transferhome.net](http://www.transferhome.net)
