Guest User

Untitled

a guest
Aug 2nd, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. Distinguish Validation Exceptions in Rails 3
  2. begin
  3. new_user = User.new
  4. new_user.name = new_user_name
  5. new_user.email = new_user_email
  6. new_user.password = new_user_password
  7. new_user.password_confirmation = new_user_password
  8. new_user.save!
  9. rescue PasswordTooShortException
  10. render :status => 452 and return
  11. rescue EmailAlreadyTakenException
  12. render :status => 453 and return
  13. end
Add Comment
Please, Sign In to add comment