2013-01-07 09:04:09 +01:00
|
|
|
# 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 rake db:seed (or created alongside the db with db:setup).
|
|
|
|
|
#
|
|
|
|
|
# Examples:
|
|
|
|
|
#
|
|
|
|
|
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
|
|
|
|
# Mayor.create(name: 'Emanuel', city: cities.first)
|
2014-02-09 18:05:57 +02:00
|
|
|
|
2014-08-01 18:27:22 +03:00
|
|
|
# Create sample user
|
2014-11-09 18:01:57 +02:00
|
|
|
user = User.new(email: 'deleted@localhost.osem', name: 'User deleted', username: 'deleted_user',
|
2014-11-09 20:37:28 +02:00
|
|
|
biography: 'Data is no longer available for deleted user.', is_disabled: true,
|
2014-08-06 22:56:11 +03:00
|
|
|
password: Devise.friendly_token[0, 20])
|
2014-08-01 18:27:22 +03:00
|
|
|
user.skip_confirmation!
|
|
|
|
|
user.save!
|
|
|
|
|
|
2014-08-12 11:51:59 +03:00
|
|
|
# Questions
|
2014-08-18 21:54:43 +03:00
|
|
|
qtype_yesno = QuestionType.create(title: 'Yes/No')
|
|
|
|
|
QuestionType.create(title: 'Single Choice')
|
|
|
|
|
QuestionType.create(title: 'Multiple Choice')
|
2014-02-09 18:05:57 +02:00
|
|
|
|
2014-08-12 11:51:59 +03:00
|
|
|
answer_yes = Answer.create(title: 'Yes')
|
|
|
|
|
answer_no = Answer.create(title: 'No')
|
2014-02-09 18:05:57 +02:00
|
|
|
|
2014-08-12 11:51:59 +03:00
|
|
|
questions_yes_no = ['Do you need handicapped access to the venue?',
|
|
|
|
|
'Are you attending with partner?', 'Will you attend the social event(s)?',
|
|
|
|
|
'Will you stay at suggested hotel?']
|
2014-02-09 18:05:57 +02:00
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
questions_yes_no.each do |i|
|
2014-07-21 14:49:05 +02:00
|
|
|
q = Question.create(title: i, question_type_id: qtype_yesno.id, global: true)
|
2014-02-09 18:05:57 +02:00
|
|
|
|
2014-07-21 14:49:05 +02:00
|
|
|
Qanswer.create(question_id: q.id, answer_id: answer_no.id)
|
|
|
|
|
Qanswer.create(question_id: q.id, answer_id: answer_yes.id)
|
2014-06-30 17:07:53 +02:00
|
|
|
end
|