Guest User

Untitled

a guest
Jul 16th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. { user: { password: "abcd", password_confirmation: "defg" }
  2.  
  3. { user: { password: "abcdefgh" } }
  4.  
  5. class User < ActiveRecord::Base
  6. ...
  7.  
  8. def update_without_password_confirmation(params={})
  9. params.delete(:password) if params[:password_confirmation].blank?
  10. params.delete(:password_confirmation) if params[:password].blank?
  11.  
  12. update_attributes(params)
  13. end
  14. end
  15.  
  16. clas User < AR::Base
  17. acts_as_authentic do |u|
  18. u.require_password_confirmation=false # you can also use :if => some_condition
  19. u.validate_password_field=false
  20. end
  21. end
Add Comment
Please, Sign In to add comment