From 1c7ddb4b2944a58acc5ec2d421eb9ad86104e50f Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 6 Dec 2012 22:29:43 +0800 Subject: [PATCH] fixed empty db bug --- db/seeds.rb | 7 +++++++ spec/factories/co_author_relations.rb | 1 - spec/factories/co_authors.rb | 1 - spec/factories/journal_level_types.rb | 1 - spec/factories/writing_journal_files.rb | 1 - spec/factories/writing_journals.rb | 1 - 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 0f4f8b98..07a19519 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,6 +1,11 @@ require 'factory_girl' require 'faker' +CoAuthorRelation.destroy_all +CoAuthor.destroy_all +JournalLevelType.destroy_all +WritingJournalFile.destroy_all +WritingJournal.destroy_all #Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f} 10.times do @@ -18,3 +23,5 @@ end 50.times do FactoryGirl.create(:co_author_candidate) end + +puts "Success!" diff --git a/spec/factories/co_author_relations.rb b/spec/factories/co_author_relations.rb index f157983e..09fc6d88 100644 --- a/spec/factories/co_author_relations.rb +++ b/spec/factories/co_author_relations.rb @@ -1,4 +1,3 @@ -CoAuthorRelation.destroy_all types = ["friend", "teacher", "student", "schoolmate", "parent", "best friend", "instructor", "labmate", "TA", "mate"] diff --git a/spec/factories/co_authors.rb b/spec/factories/co_authors.rb index 8afff831..75a11c9b 100644 --- a/spec/factories/co_authors.rb +++ b/spec/factories/co_authors.rb @@ -1,4 +1,3 @@ -CoAuthor.destroy_all name_tw = Array.new 51,"" name_tw = name_tw.map do |p| Faker::Name::name end diff --git a/spec/factories/journal_level_types.rb b/spec/factories/journal_level_types.rb index 0dddf7bd..5aee752b 100644 --- a/spec/factories/journal_level_types.rb +++ b/spec/factories/journal_level_types.rb @@ -1,4 +1,3 @@ -JournalLevelType.destroy_all level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"] diff --git a/spec/factories/writing_journal_files.rb b/spec/factories/writing_journal_files.rb index 4fc43b74..67c47e3d 100644 --- a/spec/factories/writing_journal_files.rb +++ b/spec/factories/writing_journal_files.rb @@ -1,4 +1,3 @@ -WritingJournalFile.destroy_all file_desc = Array.new 7, "" file_desc = file_desc.map do |p| Faker::Lorem.word end diff --git a/spec/factories/writing_journals.rb b/spec/factories/writing_journals.rb index e74ff32f..3c9b20ca 100644 --- a/spec/factories/writing_journals.rb +++ b/spec/factories/writing_journals.rb @@ -1,6 +1,5 @@ require 'json' -WritingJournal.destroy_all data = File.read("#{Rails.root}/db/data") data_json = JSON.parse(data)