problem with error_messages_for

I have a number of validations in client.rb like this...

  validates_length_of :first_name,
    :last_name,
    :maximum => 25,
    :message => "Maximum 25 characters and numbers combined"

and in my clients_controller.rb I have this...

  def update
    @client = Client.find(params[:id])
    if @client.update_attributes(params[:client])
      flash[:notice] = 'Client was successfully updated.'
      redirect_to :back
    else
      flash[:notice] = 'There was a problem with saving your edits.'
      redirect_to :back
    end
  end

and the first line in my view_code is

  <%= error_messages_for 'client' %>

my the flash[:notice] (on my layout) displays properly but nothing ever
displays in the view code.

What detail am I missing? Is it because I am using
':redirect_to :back' ?

Yes - you need to use render instead to preserve the errors.

> What detail am I missing? Is it because I am using
> ':redirect_to :back' ?

Yes - you need to use render instead to preserve the errors.

Does anybody has an answer for this? I have the same problem.

And adding a new user while the url is : users/save doesn't seem
"REST" to me.

If you need to access formatted errors in controllers your best bet is
to use @object.errors.full_messages, which returns an array of error
messages corresponding to the LIs that error_message_for prints out.
If you are constructing a flash message you might do something like

flash[:warning] = @object.errors.full_messages.join(" ")

Which will yield something like "Attribute X can't be blank. Attribute
Y must be numeric." etc

Beautiful. Gonna try that. Thanks.
But I think Rails won't remember the post values, right?