diff options
Diffstat (limited to 'db/seeds.rb')
-rw-r--r-- | db/seeds.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/db/seeds.rb b/db/seeds.rb index 4d06bc3..352cc18 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -46,7 +46,7 @@ APP_CONFIG['developer_data']['check'] = false # Remove existing database entries User.destroy_all Answer.destroy_all -QuestionCategory.destroy_all +Category.destroy_all QuestionGroup.destroy_all Question.destroy_all UserCategory.destroy_all @@ -56,21 +56,21 @@ User.destroy_all seeder = SeedHelper.new # Question categories -seeder.objects['ebuild'] = QuestionCategory.create! :name => 'Ebuild quiz' -seeder.objects['mentoring'] = QuestionCategory.create! :name => 'End of mentoring quiz' -seeder.objects['non'] = QuestionCategory.create! :name => 'Non-ebuild staff quiz' +seeder.objects['ebuild'] = Category.create! :name => 'Ebuild quiz' +seeder.objects['mentoring'] = Category.create! :name => 'End of mentoring quiz' +seeder.objects['non'] = Category.create! :name => 'Non-ebuild staff quiz' # Question groups seeder.objects['ebuild_group1'] = QuestionGroup.create! :name => 'ebuild_group1', :description => 'src_install implementations to comment on' # Questions with text content - load from YAML file -seeder.read_yaml('db/fixtures/questions.yml', Question, ['question_category', 'question_group']) do |name, hash, objects, klass| +seeder.read_yaml('db/fixtures/questions.yml', Question, ['category', 'question_group']) do |name, hash, objects, klass| objects[name] = klass.create! (hash - {'content' => nil}) objects["#{name}-content"] = QuestionContentText.create! :question => objects[name], :content => hash['content'] end # Questions with multiple choice content - load from YAML file -seeder.read_yaml('db/fixtures/questions-multichoice.yml', Question, ['question_category', 'question_group']) do |name, hash, objects, klass| +seeder.read_yaml('db/fixtures/questions-multichoice.yml', Question, ['category', 'question_group']) do |name, hash, objects, klass| objects[name] = klass.create!(hash - {'options' => nil, 'content' => nil}) objects["#{name}-content"] = QuestionContentMultipleChoice.create! :question => objects[name], :content => hash['content'] for opt in hash['options'].split(';') @@ -80,7 +80,7 @@ seeder.read_yaml('db/fixtures/questions-multichoice.yml', Question, ['question_c end # Questions with email content - load from YAML file -seeder.read_yaml('db/fixtures/questions-email.yml', Question, ['question_category', 'question_group']) do |name, hash, objects, klass| +seeder.read_yaml('db/fixtures/questions-email.yml', Question, ['category', 'question_group']) do |name, hash, objects, klass| objects[name] = klass.create!(hash - {'content' => nil, 'req_text' => nil}) objects["#{name}-content"] = QuestionContentEmail.create! :question => objects[name], :description=> hash['content'], :req_text => hash['req_text'] end @@ -97,7 +97,7 @@ user_cats = [ ['mentoring', 'mentor']] for uc in user_cats - UserCategory.create! :question_category => seeder.objects[uc[0]], :user => seeder.objects[uc[1]] + UserCategory.create! :category => seeder.objects[uc[0]], :user => seeder.objects[uc[1]] end |