Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3223182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:04:39+00:00 2026-05-17T16:04:39+00:00

Update: this question has been answered (see below). I’ll leave it up in case

  • 0

Update: this question has been answered (see below). I’ll leave it up in case anyone can benefit in the future.


I am trying to get e-mail confirmations working on Authlogic using Rails 3. http://github.com/matthooks/authlogic-activation-tutorial

Authentication is working and the activation e-mails are being generated and sent, each containing a perishable token, but the perishable tokens are incorrect, in that they do not match the one saved in the user’s record.

Upon following the token in the e-mail, I get: Exception in ActivationsController#create

Note: When I manually enter the correct token from the table into the URL, it validates and redirects as it is supposed to. Therefore, the only issue is that the perishable token being generated is not the same as the one being saved.

# UserMailer
class UserMailer < ActionMailer::Base  
  default :from => "notifications@myapp.com"

  def registration_confirmation(user)
    @user = user
    mail(:to => "#{user.login} <#{user.email}>", :subject => "Registered")
  end

  def activation_instructions(user)
    subject       "Activate Your Account"
    from          "noreply@myapp.com"
    recipients    user.email
    sent_on       Time.now
    body          :account_activation_url => activate_url(user.perishable_token)
  end

  def welcome(user)
    subject       "Welcome to the site!"
    from          "noreply@myapp.com"
    recipients    user.email
    sent_on       Time.now
    body          :root_url => root_url
  end
end

# E-mail itself:  
To activate, click here: <%= @account_activation_url %>

The error is occurring on line 5 where the system tries and fails to find User by token:

class ActivationsController < ApplicationController
  before_filter :require_no_user

  def create
    @user = User.find_by_perishable_token(params[:activation_code], 1.week) || (raise Exception)
    raise Exception if @user.active?

    if @user.activate!
      flash[:notice] = "Your account has been activated!"
      UserSession.create(@user, false) # Log user in manually
      @user.deliver_welcome!
      redirect_to home_url
    else
      render :controller => "welcome", :action => "linklogin"
    end
  end    
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:04:39+00:00Added an answer on May 17, 2026 at 4:04 pm

    It’s funny – sometimes the process of asking the question itself reveals the answer.

    In my users#create, there are different user types, and the action sets a couple of values after the initial validated save and saves the simple changes again without validation.

    My e-mail was being sent in between the first and second saves, so of course by the time the user clicks on the activation e-mail, the perishable_token has already been reset.

    I moved the mailing down to after the second save, and now the activation e-mail works perfectly.

    Thank you very much for any time you’ve spent considering this problem. 🙂
    Cirrus

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First time posting, please let me know if this question has already been answered!
I know this question has been asked many times before but I can't find
Update 25/03/2011 I've marked this question as answered, while I don't yet have the
Update: My original intention for this question was to determine if PHP actually has
The question has been asked a few times before, but none of them are
This is similar to other questions, yet I wasn't able to see an exact
I was trying to retrieve wall posts for a particular user, similar question has
I'm trying to make a sort of game using the HTML5 canvas, JavaScript and
I need to present a form that is not backed by an AR model.
I am running Windows 7 64 bit and have installed easy_install. When I run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.