Question

The title might not be so clear, and anyway it's better to just look at this:

My sequence of creating/destroying items A, B and C is:

  1. Create A --> id:1
  2. Create B --> id:2
  3. Destroy B
  4. Create C --> id:3

I've already destroyed B, C should be counted as id:2 right?

Was it helpful?

Solution

The underlying database column for id is set to autoincrement. The id is generated at the database level, not by ActiveRecord. If you want to know more, read up on SQL sequences or autoincrement .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top