1.dos工程路径下执行(c:home/trunk/src下):

ruby script/generatemigration  AddPermissionsData(名字随便起)

生成时间戳文件

class AddPermissionsData< ActiveRecord::Migration

def self.up

  p = Permission.create({:name => '张三', :parent_id => '367', :deleted => '0', :action => 'schedule', :sort_number => '4'})

end

def self.down

end

end

执行 rake dbmigrate

Ok…..

-------------------------------------------------------------------

2.lib-tasks下新建data_update.rake里面代码

namespace :data_permissions do

//taskonline_update随意起

 task:online_update => :environment do

ModelPermission,向表Permissions插数据

p =Permission.create({:name => '张三', :parent_id => '367', :deleted=> '0', :action => '/schedule', :sort_number=> '4'})

 end

end

执行:rake 文件名task

rake data_permissions:online_update

成功!(版本低)

高版本用:rails g migration add_data_to_p