List and update values from text_field_tag fields


#1

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


#2

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


#3

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


#4

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/


Norman T.

http://blog.inlet-media.de