# List and update values from text\_field\_tag fields

**URL:** <https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581>\
**Category:** Rails\
**Created:** [March 8, 2006, 11:50pm UTC](https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581 "2006-03-08T23:50:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Tinfors](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@Jens\_Tinfors](https://www.ruby-forum.com/u/Jens_Tinfors)\
**Post date:** [March 8, 2006, 11:50pm UTC](https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581/1 "2006-03-08T23:50:44Z")

</div>

Hi,

I populate a couple of text\_field\_tag’s with data from an AciveRecord  
object. Some fields are editable and at the end of the page there’s a  
submit button. I want the new values to be updated in the DB but by  
default my original values are stored again.  
How do i go about doing this?

thanks/jens

AIM: removed\_email\_address@domain.invalid  
Skype: jtinfors

---

<div class="post-metadata">

**Author:** ![Jens\_Tinfors](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@Jens\_Tinfors](https://www.ruby-forum.com/u/Jens_Tinfors)\
**Post date:** [March 9, 2006, 10:32am UTC](https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581/2 "2006-03-09T10:32:20Z")

</div>

Am Mittwoch, den 08.03.2006, 23:47 +0100 schrieb Jens Tinfors:

> Hi,
> 
> I populate a couple of text\_field\_tag’s with data from an AciveRecord  
> object. Some fields are editable and at the end of the page there’s a  
> submit button. I want the new values to be updated in the DB but by  
> default my original values are stored again.  
> How do i go about doing this?

Why don’t you want your unchanged values stored again?

–  
Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)

---

<div class="post-metadata">

**Author:** ![Jens\_Tinfors](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@Jens\_Tinfors](https://www.ruby-forum.com/u/Jens_Tinfors)\
**Post date:** [March 9, 2006, 11:08am UTC](https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581/3 "2006-03-09T11:08:58Z")

</div>

ohh, i dont mind the unchanged values stored again.  
My problem (and its probably a very basic such) is how do i get the  
newly  
entered values from the text\_field\_tag’s back into the db?

thanks/jens

---

<div class="post-metadata">

**Author:** ![Jens\_Tinfors](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@Jens\_Tinfors](https://www.ruby-forum.com/u/Jens_Tinfors)\
**Post date:** [March 9, 2006, 12:06pm UTC](https://www.ruby-forum.com/t/list-and-update-values-from-text-field-tag-fields/54581/4 "2006-03-09T12:06:34Z")

</div>

Am Donnerstag, den 09.03.2006, 11:06 +0100 schrieb Jens Tinfors:

> ```
> > I populate a couple of text_field_tag's with data from an
> AciveRecord
> > object. Some fields are editable and at the end of the page
> there's a 
> > submit button. I want the new values to be updated in the DB
> but by
> > default my original values are stored again.
> > How do i go about doing this?
> >
>     
> Why don't you want your unchanged values stored again? 
> 
> ```

Ok, i see.

# code in your e.g. project controller

def update  
@project = Project.find(params[:project][:id])  
if @project.update\_attributes(params[:project])  
flash[:notice] = ‘Project updated’  
redirect\_to :action =\> ‘list’  
else  
render :action =\> new  
end  
end

Perhaps you want to use the scaffold generator to generate some sample  
code to see how everything works together.

Maybe you should follow a Rails tutorial like:

[http://rails.homelinux.org/](http://rails.homelinux.org/)

–  
Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)
