创建种子数据

dev_local_2
daiao 6 years ago
parent d426aa7537
commit b3398b9ba9

@ -31,7 +31,37 @@ user_params = [
salt: '96a9104963f8f2f9d35f1f384f8e8bf7'
}
]
users = User.create!(user_params)
users.each do |user|
UserExtension.create!(user_id: user.id, gender: 0)
end
user_extension_params = [
{
id: 1,
user_id: 1,
gender: 0,
location: "湖南",
occupation: "国防科技大学",
technical_title: "副教授",
identity: 0,
location_city: "长沙",
school_id: 1,
department_id: 1
},
{
id: 2,
user_id: 2,
gender: 1,
identity: 1
}
]
school_params = {
id: 1,
name: "国防科技大学",
province: "安徽",
pinyin: 'guofangkexuejishudaxue',
school_type: 0,
city: "合肥",
address: "安徽省合肥市",
auto_users_trial: 1,
identifier: 'nudt'
}
User.create!(user_params)
UserExtension.create!(user_extension_params)
School.create!(school_params)

Loading…
Cancel
Save