Printing save error

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.

Got it.

Seems like there's an error property on all objects. Putting the following prints the errors -

      puts newuser.errors.to_yaml