fixed empty db bug
This commit is contained in:
		
							parent
							
								
									a84cb560a0
								
							
						
					
					
						commit
						1c7ddb4b29
					
				| 
						 | 
					@ -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!"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue