Created
March 27, 2012 14:25
-
-
Save theinventor/2216360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unsubscribe | |
token = Base64.decode64(params[:token]) #using base64 encoding in the url to prevent unsubscribe abuse | |
@user = User.find_by_access_token(token) #find the user from the ID in url | |
@user.opt_out = true #change them to not get email | |
@user.save #save the changes | |
redirect_to "/", :notice => "We won't bug you with emails!" #give them a little notice that it worked | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment