Forum: Ruby on Rails won't auto_increment

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bd197d8ce0d9fa1a174a13ae108fa2db?d=identicon&s=25 Bimo Remus (bimo)
on 2006-01-23 05:04
I am writing my first RoR ap and am having problems with ActiveRecord's
basic functions.  The first one is that the id column is not auto
incrementing.  I can add one record but after that it says,
"Mysql::Error: #23000Duplicate entry '0' for key 1"...

b
C8a634a01a2c4508360874bff7fb1a7f?d=identicon&s=25 Kevin Olbrich (olbrich)
on 2006-01-23 05:17
bimo remus wrote:
> I am writing my first RoR ap and am having problems with ActiveRecord's
> basic functions.  The first one is that the id column is not auto
> incrementing.  I can add one record but after that it says,
> "Mysql::Error: #23000Duplicate entry '0' for key 1"...
>
> b

Make sure your 'id' column in the MySQL table is defined as
auto_increment.
Bd197d8ce0d9fa1a174a13ae108fa2db?d=identicon&s=25 Bimo Remus (bimo)
on 2006-01-23 05:45
...  i'm so embarassed...

thanks, though
Bd197d8ce0d9fa1a174a13ae108fa2db?d=identicon&s=25 Bimo Remus (bimo)
on 2006-01-23 05:47
embarrassed
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-01-23 13:06
(Received via mailing list)
Kevin Olbrich wrote:
>
And put 'migrations' on your list of things to look at soon.  They take
that sort of problem away quite nicely.
This topic is locked and can not be replied to.