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'm fairly new to WebService developement and have just set up my own webservice
I just set up devise and receive the following error after I sign up
I've set up user auth for my rails App with Devise and Omniauth. Now
I've just started a Rails application set up with Devise. Now, I'm planning to
I just set up Devise (rails authentication plugin) to send a confirmation email upon
just set up a simple project to test the functionality of the maven exec
I just set up JDK 7 on my PC running Windows 7 and created
I just set up IDE env for Python 3. I was wondering how I
I just set up a simple virtual server with Debian netinst. Now I want
I just set up the Parallel Nsight debugging environment and started remote debugging my

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.