Forum: Ruby on Rails Newbie question on id

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E89204916672f3f1b142dff60938bf7e?d=identicon&s=25 Peter Hiltz (Guest)
on 2006-02-19 00:24
(Received via mailing list)
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
into problems with starting points and existing ids?

5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-02-19 02:21
(Received via mailing list)
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.

E89204916672f3f1b142dff60938bf7e?d=identicon&s=25 Peter Hiltz (Guest)
on 2006-02-19 02:43
(Received via mailing list)
Sigh. It is an existing database (not setup just for Ruby or Rails) with
70,000 records. No auto-increment running on the database because that
been handled by our current main application. If I do anything with
such that Rails implementation of Active Record relies on the database
autoincrement, it is not going to happen because the database does not
that function in this application.

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

This topic is locked and can not be replied to.