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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:41:03+00:00 2026-05-22T17:41:03+00:00

I just set up the Devise auth library and I am confused about how

  • 0

I just set up the Devise auth library and I am confused about how it is meant to be queried.

For example, before when I made my own users table, I made this user.rb file

class User < ActiveRecord::Base
  set_primary_key:uid
end

And I was able to query by uid like this:

@User = User.find(1)
print @User   

Now that Devise added a number of columns and the users.rb file looks like this:

class Users < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, 
         :first_name, :last_name, :organization_name

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

The above code to query this table does not work and I am not sure how it is meant to be queried.

Also, I am not sure if I should do something like this

rails generate devise User

Where am I going wrong here?

  • 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-22T17:41:04+00:00Added an answer on May 22, 2026 at 5:41 pm

    I don’t think it’s a good practice to override the Rails default primary keys, perhaps you could try finding your users the following way instead:

    @User = User.find_by_uid(1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to set some attributes just before the object is serialized, but as
Scott Gu just posted about a new set of charting controls being distributed by
I just set up my new homepage at http://ritter.vg . I'm using jQuery, but
I have just set up cruise control.net on our build server, and I am
I've just set up a new build server with the Windows 2008 .NET 3.5
I've just set up mod python with apache and I'm trying to get a
I have a WPF app which snaps to screen edges (I just set the
So, when playing with the development I can just set settings.DEBUG to True and
My requirement is just to display a set of values retrieved from database on
I've just setup a new project on SourceForge and the admins set it up

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.