Got it.
Seems like there''s an error property on all objects. Putting the
following prints the errors -
puts newuser.errors.to_yaml
On Nov 11, 1:01 am, Gandalf
<gandalf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I am new to Ruby and am facing issue while debugging a bug in my rails
> application.
>
> When I am trying to save an object, an error is encountered. I am not
> sure how to view the errors. Any help is appreciated.
>
> Here''s the snippet:
>
> newuser = User.new
> newuser.email = email_new
> newuser.login = login
> newuser.password = login
>
> puts "Saving new user"
> if(newuser.save)
> puts "Done Saving new user"
> else
> puts "User Not saved"
> # How to print the errors??
> end
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---