fixed empty db bug

This commit is contained in:
Rueshyna 2012-12-06 22:29:43 +08:00
parent 633a68675a
commit 749e794c30
6 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,11 @@
require 'factory_girl' require 'factory_girl'
require 'faker' 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} #Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
10.times do 10.times do
@ -18,3 +23,5 @@ end
50.times do 50.times do
FactoryGirl.create(:co_author_candidate) FactoryGirl.create(:co_author_candidate)
end end
puts "Success!"

View File

@ -1,4 +1,3 @@
CoAuthorRelation.destroy_all
types = ["friend", "teacher", "student", "schoolmate", "parent", "best friend", "instructor", "labmate", "TA", "mate"] types = ["friend", "teacher", "student", "schoolmate", "parent", "best friend", "instructor", "labmate", "TA", "mate"]

View File

@ -1,4 +1,3 @@
CoAuthor.destroy_all
name_tw = Array.new 51,"" name_tw = Array.new 51,""
name_tw = name_tw.map do |p| Faker::Name::name end name_tw = name_tw.map do |p| Faker::Name::name end

View File

@ -1,4 +1,3 @@
JournalLevelType.destroy_all
level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"] level = ["SCI", "SCIE", "SSCI", "AH & HCI", "EI", "CSCI", "CSSCI", "TSCI", "TSSCI", "THCI"]

View File

@ -1,4 +1,3 @@
WritingJournalFile.destroy_all
file_desc = Array.new 7, "" file_desc = Array.new 7, ""
file_desc = file_desc.map do |p| Faker::Lorem.word end file_desc = file_desc.map do |p| Faker::Lorem.word end

View File

@ -1,6 +1,5 @@
require 'json' require 'json'
WritingJournal.destroy_all
data = File.read("#{Rails.root}/db/data") data = File.read("#{Rails.root}/db/data")
data_json = JSON.parse(data) data_json = JSON.parse(data)