MySQL + ActiveRecord でシーケンス番号を生成。

MySQLとActiveRecordでsequenceみたいなことをする方法。LAST_INSERT_ID()を使う。ここらへんを参考に。 http://dev.mysql.com/doc/refman/5.1/ja/information-functions.html#function_last-insert-id モデルを生成。 $ ./script/generate model xxx_sequencemigration class XxxSequences < ActiveRecord::Migration def…