Skip to content

Instantly share code, notes, and snippets.

@robertwclark
Created July 11, 2012 18:32
Show Gist options
  • Save robertwclark/3092217 to your computer and use it in GitHub Desktop.
Save robertwclark/3092217 to your computer and use it in GitHub Desktop.
Activation Email Problems
## 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