# Update scaffolding form field

**URL:** <https://www.ruby-forum.com/t/update-scaffolding-form-field/105866>\
**Category:** Ruby\
**Created:** [June 4, 2007, 4:21am UTC](https://www.ruby-forum.com/t/update-scaffolding-form-field/105866 "2007-06-04T04:21:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dafritz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/958977/32.png) [@dafritz](https://www.ruby-forum.com/u/dafritz)\
**Post date:** [June 4, 2007, 4:21am UTC](https://www.ruby-forum.com/t/update-scaffolding-form-field/105866/1 "2007-06-04T04:21:28Z")

</div>

This may be a basic question, but i have an “image” field in a “news”  
table, and have a form that uploads the image. Following the upload,  
the “new” action is called in the rails scaffolding so i can add the  
rest of the news to db entry. I however want the “image” field to  
contain the image id that was just created in my image table. I send  
the value to the new action, but cannot get the field to default to  
this value. I have tried :locals =\> { :image =\> :id} to see if that  
overrides the default value set in the partial. As i am fairly  
unfamiliar with where the scaffolding is storing the information for  
this form I am having trouble figuring this out. Here is the code for  
the view. The second form is the form I am using to upload the image.  
So my question is how do i get the image field to use a default value  
that was passed to the view rather than what is stored as default in  
my db.

# New news

\<%= start\_form\_tag :action =\> ‘create’ %\>  
\<%= render :partial =\> ‘form’%\>  
\<%= submit\_tag “Create” %\>

\<%= end\_form\_tag %\>

\<%= form\_tag({:action=\>‘save\_picture’}, :multipart =\> true)%\>

\<%= link\_to ‘Back’, :action =\> ‘list’ %\>
