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
On 1/6/07, Skeets <skillet3232-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
wrote:>
>
> 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...
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---