Validation error messages

i’m having a problem getting ahold of the validation error message.


mileage model:

validates_presence_of :title

mileage controller:

def create
if @mileage.save
redirect_to :action => ‘list’
else
redirect_to :action => ‘new’
end
end

def new
#stuff here
end

new.rhtml

<%= error_messages_for “mileage” %>
#also tried <%= error_messages_for :mileage %>


new.rhtml is displayed, but no error message is displayed.

what am i doing wrong?

tia…

Kinda bad news, you’ll need to save the errors to a flash and roll your
own
helper for outputting the errors [I’ve dont this, it’s not that hard] OR
you’ll have to not redirect_to :new when @mileage.save fails.
error_messages_for doesn’t work after a redirect.

RSL