# Not sure where to begin updating a child table

**URL:** <https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633>\
**Category:** Rails\
**Created:** [November 22, 2005, 9:12pm UTC](https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633 "2005-11-22T21:12:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.filipowski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@a.filipowski](https://www.ruby-forum.com/u/a.filipowski)\
**Post date:** [November 22, 2005, 9:12pm UTC](https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633/1 "2005-11-22T21:12:05Z")

</div>

I have a table that is defined as has\_many and the child table is  
defined as has\_one. I can create new children with ease and do almost  
everything else I want to do with it except for one thing. I have a  
form and within that form I have text boxes to update a column in the  
the children objects (multiple). In that same form I want to also  
update columns and attributes of the parent. Does anyone have an  
example to have a single button form that updates multiple tables/  
models? Or can you point me to the right tutorial? Agile Web  
Development mentions passing an array to the update method but there  
is no example.

Thanks

Andrew

---

<div class="post-metadata">

**Author:** ![a.filipowski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@a.filipowski](https://www.ruby-forum.com/u/a.filipowski)\
**Post date:** [November 22, 2005, 9:56pm UTC](https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633/2 "2005-11-22T21:56:21Z")

</div>

To clarify here is some code that I have tried:

My controller has this action:

def update\_radio\_buttons  
@field = Field.find(params[:id])  
@field.update\_attributes(:field\_text =\> params[:field\_text],  
:required =\> params[:required])  
for @value in @field.values  
value\_text = “:valuetext\_#{@value.id}”  
@temp = params[value\_text]  
@value.update\_attribute(:value\_text =\> @temp)  
end  
# more stuff here  
end

view:

my view looks sort of like this (i condensed the partials and some of  
the other stuff going on on the page to save some space here)

\<%= form\_remote\_tag( :update =\> ‘FieldDesignArea’,  
:url =\> { :action =\> ‘update\_radio\_buttons’, :id =\>  
@field.id }) %\>  
Field:  
  
\<%= text\_area\_tag(:field\_text, @field.field\_text) %\>  
  
  
Values:

  
\<% for @value in @field.values %\>  

  

 \<% end %\> 

The error that I get when I run this code after making a change is  
the following:

wrong number of arguments (1 for 2)

and the parameters look like this:

Parameters: {“commit”=\>“Udate”, “valuetext\_58”=\>“huh”,  
“valuetext\_71”=\>“Choice”, “id”=\>“106”, “required”=\>“1”, “\_”=\>"",  
“field\_text”=\>“New Field Is here”}

So that is in a nut shell what I am trying to do. Any help would be  
greatly appreciated.

Andrew

---

<div class="post-metadata">

**Author:** ![a.filipowski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@a.filipowski](https://www.ruby-forum.com/u/a.filipowski)\
**Post date:** [November 22, 2005, 10:08pm UTC](https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633/3 "2005-11-22T22:08:25Z")

</div>

I copied a directory of views and noticed that the  
Scaffold.CSS stylesheet didn’t add to my pages. Is  
there a way to manually link to a style sheet?

* * *

Yahoo! Mail - PC Magazine Editors’ Choice 2005

> **[\[object](https://mail.yahoo.com/)**
>
> \[object

---

<div class="post-metadata">

**Author:** ![a.filipowski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@a.filipowski](https://www.ruby-forum.com/u/a.filipowski)\
**Post date:** [November 23, 2005, 3:17pm UTC](https://www.ruby-forum.com/t/not-sure-where-to-begin-updating-a-child-table/48633/4 "2005-11-23T15:17:33Z")

</div>

\<%= stylesheet\_link\_tag “your\_css\_stylesheet” %\>
