Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !!In User.rb
- def change_password(password)
- write_attribute("crypted_password", encrypt(password))
- end
- !!In the controller
- def send_password
- @error_text = "Your email address was not found in the system. Please register for an account."
- if params[:email].any?
- @users = User.find(:first, :conditions => "email = '" + params[:email] + "'")
- if @users
- @new_pass = generate_password
- @users.change_password(@new_pass)
- Notifier.deliver_password_reminder(@users, @new_pass)
- flash[:notice] = "A new password has been sent to you. Please check your email and log in with the new password."
- redirect_back(2)
- end
- else
- redirect_back(1)
- end
- end
- !!I get this error
- NoMethodError (undefined method `change_password' for #<User:0x4075fa30>)
Add Comment
Please, Sign In to add comment