|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
May 22, 2008 I see this come up on the Rails list from time to time, so I figured I'd document it here as a blog entry. To get the next auto_increment id from a MySQL table using ActiveRecord: @next = ActiveRecord::Base.connection.execute( " SELECT auto_increment FROM information_schema.tables WHERE table_name='foo' " ).fetch_hash['auto_increment'].to_i
|
|
||||||||||||||||||||||
|
|||||||||||||||||||||||