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' ?
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