谢谢,拉姆亚.
class Foo < ActiveRecord::Migration def self.up User.create(:username => "Hello",:role => "Admin") end def self.down User.delete_all(:username => "Hello") end end
只需在迁移中编写常规ruby,就像在pry或rails控制台中一样.