Error handling

Hi,

I’m stuck right now with a problem concerning error handling. I’ll try
to
explain the problem in short:

In a controller class I have a method edit:

def edit
@some_class = SomeClass.find(params[:id])
end

The record originates from a database table. What happens if the user
enters
a field that fails validation and I return to my edit page? I get the
idea
that th original value from the database gets reloaded all the time, but
I
want to see the value the user entered.

I try to create my own list of validation errors by looping through the
errors-object of the model, but I get the impression this one’s also
reset
by the find-statement of my mini-example.

Hopefully somebody understands what I mean and can help me out.

Thanks in advance,
Walter

Walter Horstman wrote:

enters a field that fails validation and I return to my edit page? I get
the idea that th original value from the database gets reloaded all the
time, but I want to see the value the user entered.

I try to create my own list of validation errors by looping through the
errors-object of the model, but I get the impression this one’s also
reset by the find-statement of my mini-example.

def edit
@some_class = SomeClass.find( params[:id] )
if request.post? && @some_class.update_attributes(
params[:some_class] )
redirect_to :action => ‘edit_successful’
end
end


We develop, watch us RoR, in numbers too big to ignore.