Guest User

Untitled

a guest
Feb 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. !!In User.rb
  2. def change_password(password)
  3. write_attribute("crypted_password", encrypt(password))
  4. end
  5.  
  6. !!In the controller
  7. def send_password
  8. @error_text = "Your email address was not found in the system. Please register for an account."
  9. if params[:email].any?
  10. @users = User.find(:first, :conditions => "email = '" + params[:email] + "'")
  11. if @users
  12. @new_pass = generate_password
  13. @users.change_password(@new_pass)
  14. Notifier.deliver_password_reminder(@users, @new_pass)
  15. flash[:notice] = "A new password has been sent to you. Please check your email and log in with the new password."
  16. redirect_back(2)
  17. end
  18. else
  19. redirect_back(1)
  20. end
  21. end
  22.  
  23. !!I get this error
  24.  
  25. NoMethodError (undefined method `change_password' for #<User:0x4075fa30>)
Add Comment
Please, Sign In to add comment