You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/seeds.rb

77 lines
1.9 KiB

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
# 创建匿名用户
user_params = [
{
id: 1,
login: 'educoder',
5 years ago
hashed_password: '6763c9a6d5c201903feed5950a2c4459cef8d3ec',
lastname: '社区导师',
mail: '721773699@qq.com',
admin: 1,
status: 1,
type: 'User',
language: 'zh',
nickname: 'Educoder',
show_realname: '社区导师',
professional_certification: 1,
certification: 1,
5 years ago
salt: '3dce3e3983227c40c48a25419d41de7e',
profile_completed: 1
},
{
id: 2,
hashed_password: 'aaacd2fdabaaa3a54c4ada625a2611b5f0ffa437',
status: 3,
type: 'AnonymousUser',
salt: '96a9104963f8f2f9d35f1f384f8e8bf7'
}
]
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'
}
department_params = {
id: 1,
name: '电子对抗学院',
school_id: 1,
is_auth: 1
}
User.create!(user_params)
UserExtension.create!(user_extension_params)
School.create!(school_params)
Department.create!(department_params)