-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseeds.rb
16 lines (15 loc) · 842 Bytes
/
seeds.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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)
AdminUser.create!(email: '[email protected]', password: 'password', password_confirmation: 'password') if Rails.env.development?
now = DateTime.now
question_keys = %i(content answer created_at updated_at)
question_values = [
['How many letters are there in the English alphabet?', '26', now, now],
['What is the capital of <span style="color:red;">Japan</span> ?', 'Tokyo', now, now],
]
Question.create!(question_values.map { |value| question_keys.zip(value).to_h })