Make unbreakable bonds belong to the same affinity group in seeds
This commit is contained in:
parent
16914c874b
commit
204771ef2b
18
db/seeds.rb
18
db/seeds.rb
@ -60,13 +60,17 @@ end
|
||||
guest.save!
|
||||
end
|
||||
|
||||
Guest.affinity_group_counts.each do |group|
|
||||
couples = (group.taggings_count / 4).floor
|
||||
|
||||
Guest.all.sample(100).each_slice(2) do |a, b|
|
||||
bond_name = "#{a.full_name} & #{b.full_name}"
|
||||
guests_involved = Guest.tagged_with(group.name).limit(couples * 2)
|
||||
guests_involved.each_slice(2) do |a, b|
|
||||
bond_name = "#{a.full_name} & #{b.full_name}"
|
||||
|
||||
a.unbreakable_bond_list.add(bond_name)
|
||||
b.unbreakable_bond_list.add(bond_name)
|
||||
a.unbreakable_bond_list.add(bond_name)
|
||||
b.unbreakable_bond_list.add(bond_name)
|
||||
|
||||
a.save!
|
||||
b.save!
|
||||
end
|
||||
a.save!
|
||||
b.save!
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user