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 1898580
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:46:57+00:00 2026-05-17T06:46:57+00:00

I’ve previously implemented Authlogic for authorization on my site. Now however I wish to

  • 0

I’ve previously implemented Authlogic for authorization on my site. Now however I wish to switch over to using Devise instead, and I’m wondering if anyone has any experience with this. Perhaps anyone’s seen a blog post on the subject?

Thank you.

  • 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-17T06:46:58+00:00Added an answer on May 17, 2026 at 6:46 am

    I myself switched from Authlogic to Devise recently and also didn’t find any articles. However, in the simple case, once you’ve thrown away all of your user_session and other authlogic-related code, the main piece of work is converting your old users table to the format expected by devise.

    My old table looked like this:

          Column       |           Type           |                     Modifiers                      
    -------------------+--------------------------+----------------------------------------------------
     id                | integer                  | not null default nextval('users_id_seq'::regclass)
     login             | character varying(256)   | not null
     password          | character varying(64)    | not null
     created_at        | timestamp with time zone | not null
     updated_at        | timestamp with time zone | not null
     persistence_token | character varying(255)   | not null
    Indexes:
        "users_pkey" PRIMARY KEY, btree (id)
        "index_users_on_persistence_token" UNIQUE, btree (persistence_token)
        "users_login_key" UNIQUE, btree (login)
    

    and I determined that the table would have to contain at least the following info for devise (with many optional features enabled):

     id                   | integer                     | not null default nextval('contributors_id_seq'::regclass)
     email                | character varying(255)      | not null default ''::character varying
     encrypted_password   | character varying(128)      | not null default ''::character varying
     password_salt        | character varying(255)      | not null default ''::character varying
     confirmation_token   | character varying(255)      | 
     confirmed_at         | timestamp without time zone | 
     confirmation_sent_at | timestamp without time zone | 
     reset_password_token | character varying(255)      | 
     remember_token       | character varying(255)      | 
     remember_created_at  | timestamp without time zone | 
     sign_in_count        | integer                     | default 0
     current_sign_in_at   | timestamp without time zone | 
     last_sign_in_at      | timestamp without time zone | 
     current_sign_in_ip   | character varying(255)      | 
     last_sign_in_ip      | character varying(255)      | 
     failed_attempts      | integer                     | default 0
     unlock_token         | character varying(255)      | 
     locked_at            | timestamp without time zone | 
     created_at           | timestamp without time zone | 
     updated_at           | timestamp without time zone | 
    

    So I defined an unadorned activerecord class in the migration class

     class ConversionUser < ActiveRecord::Base
       set_table_name "users"
     end
    

    and then here’s the “up” migration code I ended up using (with PostgreSQL):

    add_column :users, :email, :string, :limit => 255
    execute "UPDATE users SET email = login || '@somedomain.net'"
    execute "ALTER TABLE users ALTER email SET NOT NULL"
    
    add_column :users, :encrypted_password, :string, :limit => 128
    add_column :users, :password_salt, :string, :limit => 255
    
    require 'devise/encryptors/bcrypt'
    ConversionUser.find(:all).each do |u|
      password_salt = Devise::Encryptors::Bcrypt.salt(Devise.stretches)
      u.update_attributes!(:password_salt => password_salt,
                           :encrypted_password => Devise::Encryptors::Bcrypt.digest(u.password, Devise.stretches, password_salt, Devise.pepper))
    end
    
    add_column :users, :confirmation_token, :string, :limit => 255
    add_column :users, :confirmed_at, :timestamp
    add_column :users, :confirmation_sent_at, :timestamp
    execute "UPDATE users SET confirmed_at = created_at, confirmation_sent_at = created_at"
    add_column :users, :reset_password_token, :string, :limit => 255
    
    add_column :users, :remember_token, :string, :limit => 255
    add_column :users, :remember_created_at, :timestamp
    add_column :users, :sign_in_count, :integer, :default => 0
    add_column :users, :current_sign_in_at, :timestamp
    add_column :users, :last_sign_in_at, :timestamp
    add_column :users, :current_sign_in_ip, :string, :limit => 255
    add_column :users, :last_sign_in_ip, :string, :limit => 255
    
    add_column :users, :failed_attempts, :integer, :default => 0
    add_column :users, :unlock_token, :string, :limit => 255
    add_column :users, :locked_at, :timestamp
    
    remove_column :users, :password
    remove_column :users, :persistence_token
    
    add_index :users, :email,                :unique => true
    add_index :users, :confirmation_token,   :unique => true
    add_index :users, :reset_password_token, :unique => true
    add_index :users, :unlock_token,         :unique => true
    

    Note that here I’ve converted a plain password column into a bcrypt-encrypted column for Devise — if you’ve used encrypted passwords with Authlogic, then you’ll probably want to just rename the column (if necessary) and choose the correct encryptor module in config/initializers/devise.rb.

    For reference, the “devise” clause in my User model looks like this:

    devise :database_authenticatable, :registerable, :recoverable,
      :rememberable, :trackable, :validatable, :confirmable, :lockable,
      :timeoutable, :authentication_keys => [ :login ]
    

    Note that overriding :authentication_keys like this so that users sign in with their login rather than their email address required me to modify some of the devise views: rails generate devise:views, then edit the files.

    Hope this helps a bit. Good luck!

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.