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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:02:17+00:00 2026-05-26T00:02:17+00:00

In rails devise when I set up a user, then delete him, then recreate

  • 0

In rails devise when I set up a user, then delete him, then recreate I get a weird effect.
Like this, kevin … (delete) … recreate kevin then the new url is kevin –2 (if I do this again it is kevin –3. make it stop

  • 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-26T00:02:17+00:00Added an answer on May 26, 2026 at 12:02 am

    if you create a user in a Rails application, and then delete the user, the ID in the database for that user will be not available after the user is deleted.

    e.g. you start with an empty system, there are no entries in the User table…

    100.times do |i|
       u = User.create(:name => "Kevin")    
       puts "User ID: #{u.id}"
       u.delete
    end
    

    what you will see is that IDs from 1..100 are used — each new user entry (regardless if the name is the same!) will have the consecutively higher ID , e.g. the next available unused ID in the DB.
    And you will see that ID of course as part of the restful URL.

    If you run the above code twice, you will see that it will use IDs 101..200 the second time around.

    So what you are seeing is normal Rails behavior.

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

Sidebar

Related Questions

I've set up user auth for my rails App with Devise and Omniauth. Now
My rails 3 app uses devise, and we have it set so a user
I'm relatively new to rails. I have Devise set up, and want to run
I would like to redirect upon user destroy in devise with rails 3.1 How
I'm new to rails, and even more new to devise. I have set up
Rails gurus: I've just discovered named_scope thanks to another SO user. :) I'd like
I'm building a Rails application using Devise. Devise is all set up even omniauth.
I have this application where I use Devise and, after login the user is
I installed devise successfully: @ubuntu:~/boltzman$ rails generate devise User invoke active_record create db/migrate/20111109080820_devise_create_users.rb create
I'm using Rails 3 with Devise for user auth. Let's say I have a

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.