/
seeds.rb
37 lines (31 loc) · 1.81 KB
/
seeds.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
Category.create(
%w{Ruby Javascript Rails CMS CRM Testing Nodejs Gem Api }.collect { |c| { name: c } }
)
Setting.consumer_key = 'your consumer key here'
Setting.consumer_secret = 'your consumer secret here.'
#Setting.oauth_token = 'your twitter access token'
#Setting.oauth_token_secret = 'your twitter access token secret'
5.times do |i|
User.create({name: "test#{i}", email: "test#{i}@testers.com", screen_name: "testers#{i}"})
end
10.times do |i|
idea = Idea.new({
title: "Idea title#{i}",
description: "a. A integer. Et? Est diam ridiculus mattis scelerisque, scelerisque cras, in ultricies? Ultricies sociis velit quis scelerisque sit scelerisque cum diam a odio adipiscing? Duis egestas et sociis. Nec sed porttitor, pulvinar eros integer a aenean sociis placerat? Elit aliquam. Quis quis cum sit in velit? Massa duis sociis mus porta? ",
github: 'http://github.com/something/#{i}',
original_desc: "a. A integer. Et? Est diam ridiculus mattis scelerisque, scelerisque cras, in ultricies? Ultricies sociis velit quis scelerisque sit scelerisque cum diam a odio adipiscing? Duis egestas et sociis. Nec sed porttitor, pulvinar eros integer a aenean sociis placerat? Elit aliquam. Quis quis cum sit in velit? Massa duis sociis mus porta? "
})
idea.user = User.all.shuffle.first
idea.save
end
20.times do |i|
## Randomly assign few categories to the few ideas.
IdeaCategory.create({idea_id: Idea.all.shuffle.first.id, category_id: Category.all.shuffle.first.id})
end