Newbie question on id


#1

Our existing database uses id as primary key. Our current application,
not the
database itself, determines the next unique id for a new entry.

How does Active Record create the unique integer? I.e, are we going to
run
into problems with starting points and existing ids?

TIA.


#2

If you set up the database according to the standard, the id column will
be ‘primary-key’ and ‘auto-incremement’. Thus, the database does the
incrementing, not ActiveRecord. My guess would be that if you supply
the ID number and turn off the auto-increment, that it will work fine.

_Kevin


#3

Sigh. It is an existing database (not setup just for Ruby or Rails) with
about
70,000 records. No auto-increment running on the database because that
has
been handled by our current main application. If I do anything with
Rails,
such that Rails implementation of Active Record relies on the database
to
autoincrement, it is not going to happen because the database does not
handle
that function in this application.

If the Active Record implementation on Rails can calculate the next id,
fine,
it won’t create interference. I just don’t understand how Rails
determines
the next unique id if that is not handled by the database.

Peter