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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:41:53+00:00 2026-05-31T19:41:53+00:00

I am running into some slightly tricky issues with a legacy db. Everything seems

  • 0

I am running into some slightly tricky issues with a legacy db. Everything seems to work fine if I simply change the “password” column name in the db to “encrypted_password”; however, I need to leave the db in place.

So I decided to use

alias_attribute :encrypted_password, :password

Now I get a “stack level too deep” error in the console.

My user model:

class User < ActiveRecord::Base
  require "digest/sha1"
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :encryptable, :encryptor => :old_cakephp_auth

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me
  has_many :events

  before_create :add_default_values

  #alias_attribute :created_at, :created  
  #alias_attribute :updated_at, :updated
  alias_attribute :encrypted_password, :password

  def add_default_values
    self.created = Time.now
    self.updated = Time.now
    self.image = ""
    self.name = self.email.split("@").first
    #make normal user
    self.role_id = 2
    self.username = self.email.split("@").first + rand(100000000000000).to_s
    self.website = ""
  end

  def valid_password?(password)
    return false if encrypted_password.blank?
    Devise.secure_compare(Digest::SHA1.hexdigest(self.password_salt+password), self.encrypted_password)
  end
end

Ideas? Thanks!!! 🙂

  • 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-31T19:41:54+00:00Added an answer on May 31, 2026 at 7:41 pm

    I imagine that this is due to devise reserving the word password for their own use (and it in turn calling encrypted_password. Try renaming it to pword and see if the error still occurs. If it doesn’t, you’ll have to find another name to call the aliased password.

    I should say that this is just an assumption. Let me know if it helps.

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

Sidebar

Related Questions

I'm currently running into some issues resizing images using GD. Everything works fine until
I'm running into some issues with having a lot of UIImages in memory, so
I have been running into some issues with animating multiple CALayers at the same
Lately I've been running into some subtle layout issues in my iOS app. For
I'm running into some issues with boost::bind and creating threads. Essentially, I would like
I'm running into some issues doing a describeSObject call from a ruby on rails
I'm working with parsing JSON into my app and am running into some issues
I'm running into some little glitch on Internet Explorer. The site looks like it
I'm running into some compiler errors I don't understand. I'm pretty sure I'm doing
I'm running into some problems using my .NET 4.0 libraries in .NET 2.0 applications.

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.