Created
July 11, 2012 18:32
-
-
Save robertwclark/3092217 to your computer and use it in GitHub Desktop.
Activation Email Problems
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
## From User Model ## | |
def send_activation_email | |
reset_perishable_token! | |
UserMailer.activation(self).deliver | |
end | |
##Controller for Activation Email## | |
class ActivationsController < ApplicationController | |
def create | |
if @user = User.find_using_perishable_token(params[:token]) | |
@user.active = true | |
@user.save | |
flash[:notice] = "Congratulations your account is now active" | |
else | |
flash[:notice] = "Please sign up for an account" | |
end | |
redirect_to root_path | |
end | |
end | |
## Activation Email Text ## | |
Welcome to RumbaFish | |
Please click the following link to activate your account: | |
<% activate_url(:token => @user.perishable_token, :host => "localhost:3000") %> | |
## UserMailer ## | |
def activation(user) | |
@user = user | |
mail :to => user.email, :from =>"activation@rumbafish", :subject =>"Account Activation" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment