Be careful of BIGINT primary key fields in MySQL. Will cause problems with ActiveRecord create (but


#1

The MySQL/Ruby library doesn’t properly handle inserts into tables
with the primary key being a BIGINT

If the ID returned to the MySQL/Ruby library is LARGER than the INT
range, the value is returned to Ruby truncated and incorrect. This is
then passed up to ActiveRecord and into the id field of your model.
The actual INSERT worked properly and when do you an ActiveRecord find
for the object, it will have the proper id (assuming you find it via
another method other than the truncated id returned).

http://rubyforge.org/tracker/index.php?func=detail&aid=24387&group_id=4550&atid=17562

Where it gets really messy is if you have associations on the model
you are creating, the ID that is returned to AR is incorrect and it
inserts it into the associated models that get auto-saved.