can display relation between author
This commit is contained in:
1 parent
f89a6194c4
commit
9759a32394
5 files changed
+22
-7
No files matched your search
+16
-3
@@ -2,8 +2,9 @@ require 'factory_girl'
|
||||
require 'faker'
|
||||
require 'json'
|
||||
|
||||
WritingJournal.destroy_all
|
||||
CoAuthor.destroy_all
|
||||
CoAuthorRelation.destroy_all
|
||||
WritingJournal.destroy_all
|
||||
|
||||
data = File.read("db/data")
|
||||
data_json = JSON.parse(data)
|
||||
@@ -16,13 +17,21 @@ name_en = name_en.map do |p| Faker::Name::name end
|
||||
email = Array.new 51,""
|
||||
email= email.map do |p| Faker::Internet.email end
|
||||
|
||||
type = ["friend", "teacher", "student", "mate", "relation"]
|
||||
type = ["friend0", "teacher0", "student0", "mate0", "relation0", "friend1", "teacher1", "student1", "mate1", "relation1"]
|
||||
|
||||
FactoryGirl.define do
|
||||
factory(:type, class: "CoAuthorRelation") do |f|
|
||||
f.sequence(:relation_translations) do |n|
|
||||
{ zh_tw: "#{type[n%type.size]}",
|
||||
en: "#{type[n%type.size]}" }
|
||||
end
|
||||
end
|
||||
|
||||
factory(:co_author_candidate, class: "CoAuthor") do |f|
|
||||
|
||||
f.sequence(:co_author_translations) do |n|
|
||||
{ zh_tw: "#{name_tw[n]}",
|
||||
en: "#{name_en[n]}" }
|
||||
en: "#{name_en[n]}" }
|
||||
end
|
||||
f.sequence(:type) do |n| "#{type[n%5]}" end
|
||||
f.sequence(:email) do |n| "#{email[n]}" end
|
||||
@@ -81,6 +90,9 @@ FactoryGirl.define do
|
||||
end
|
||||
end
|
||||
|
||||
10.times.each do
|
||||
FactoryGirl.create(:type)
|
||||
end
|
||||
|
||||
50.times.each do
|
||||
FactoryGirl.create(:paper_record)
|
||||
@@ -89,3 +101,4 @@ end
|
||||
50.times.each do
|
||||
FactoryGirl.create(:co_author_candidate)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user