Skip to content
This repository has been archived by the owner on Aug 9, 2018. It is now read-only.

Commit

Permalink
Add create staff_members
Browse files Browse the repository at this point in the history
  • Loading branch information
koudaiii committed Mar 9, 2016
1 parent dfa1428 commit 25d9241
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions db/seeds/development/staff_members.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,37 @@
suspended: true,
start_date: Date.today,
)

family_names = %w(
佐藤:サトウ:sato
鈴木:スズキ:suzuki
高橋:タカハシ:takahashi
田中:タナカ:tanaka
てすと:テスト:test
)

given_names = %w(
次郎:ジロウ:jiro
三郎:サブロウ:saburo
松子:マツコ:matsuko
竹子:タケコ:takeko
梅子:ウメコ:umeko
太郎:タロウ:taro
)

20.times do |n|
fn = family_names[n % 4 ].split(':')
gn = given_names[ n % 5 ].split(':')

StaffMember.create!(
email: "#{fn[2]},#{gn[2]}@example.com",
family_name: fn[0],
given_name: gn[0],
family_name_kana: fn[1],
given_name_kana: gn[2],
password: 'password',
start_date: (1000 - n).days.ago.to_date,
end_date: n == 0 ? Date.today : nil,
suspended: n == 1,
)
end

0 comments on commit 25d9241

Please sign in to comment.