Pergunta

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?

Foi útil?

Solução

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 .

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top