Why: Its a really huge script, and conflicts are hard to resolve on forks, with indivudal scripts its easier to make custom changes. How: Following @mariacheca example using require_relative and a file under the db/dev_seeds/ folder
23 lines
677 B
Ruby
23 lines
677 B
Ruby
section "Voting Debates, Proposals & Comments" do
|
|
not_org_users = User.where(['users.id NOT IN(?)', User.organizations.pluck(:id)])
|
|
100.times do
|
|
voter = not_org_users.level_two_or_three_verified.all.sample
|
|
vote = [true, false].sample
|
|
debate = Debate.all.sample
|
|
debate.vote_by(voter: voter, vote: vote)
|
|
end
|
|
|
|
100.times do
|
|
voter = not_org_users.all.sample
|
|
vote = [true, false].sample
|
|
comment = Comment.all.sample
|
|
comment.vote_by(voter: voter, vote: vote)
|
|
end
|
|
|
|
100.times do
|
|
voter = not_org_users.level_two_or_three_verified.all.sample
|
|
proposal = Proposal.all.sample
|
|
proposal.vote_by(voter: voter, vote: true)
|
|
end
|
|
end
|