I have problems using the update_attributes function in my controller.
Sometimes works and sometimes doesn’t. I can always make it work if I
put a breakpoint just before the update_attributes function. What does
that mean?. Why is it doing this?.
Please help. If I don’t get this working I’ll quit Rails for good, it’s
caused me a lot of trouble, I’m starting not to like it.
Thanks.
Here is my code:
def update
@persona = Persona.find(params[:id])
@persona.fecha_modificacion = Time.now
@persona.modificacion_user_id = 1
if @persona.fecha_creacion? == nil
@persona.fecha_creacion = @persona.fecha_modificacion
@persona.creacion_user_id = @persona.modificacion_user_id
@persona.eliminado = 0
end
#breakpoint
if @persona.update_attributes(params[:persona])
flash[:notice] = 'Persona was successfully updated.'
redirect_to :action => 'ver', :id => @persona
else
render :action => 'list'
end
end