You might want to try something like this:

else
  flash[:warning] = @user.errors.full_messages.join("<br />")
  render :action => "new"
end

and put <%= flash[:warning] %> somewhere in your view.

There's also a way to get your model validations to show in the form,
but I don't have an example of how to do such a thing. Of course,
@user.errors will also be sent to your view if you don't specify the
flash like I did above, but I like this way more because you will be
able to re-use this solution or even include the flash somewhere in
your layout.

Hope this helps!

Kind regards,
Jaap Haagmans
w. http://www.relywebsolutions.nl


On 12 aug, 18:39, Gabriel Bianconi <[email protected]> wrote:
> Yes, it goes to the view, but the errors doesn't appear in the view...
> How do I send them?
>
> On 12 ago, 05:43, jhaagmans <[email protected]> wrote:
>
> > He might be saving it twice because turning an empty string into MD5
> > will give an MD5 hash as well. I'm not sure whether that's also the
> > case in Rails, but it is in PHP. Doing an if with the empty password
> > will give an error and not save it at all. Doing an if with a password
> > string will save it and then re-save the altered string.
>
> > > Now, the problem is that the errors don't appear.
>
> > Where is it that they don't appear? In your log? Because that sounds
> > strange to me. It should say something, even if it's actually saving
> > everything.
>
> > It doesn't give an error in your view because you don't send any
> > errors to your view:
>
> > else
> >   render :action => "new"
> > end
>
> > It does send you back to the "new" view however. Does that happen? If
> > you want it to show an error, you should actually send an error to the
> > view.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to