Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
Add Faker gem and seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlacan committed Aug 11, 2017
1 parent d038df7 commit ee5107c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ group :development, :test do

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'faker'
end
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ GEM
railties (~> 4.0)
erubis (2.7.0)
execjs (2.6.0)
faker (1.6.6)
i18n (~> 0.5)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.18)
Expand Down Expand Up @@ -211,6 +213,7 @@ DEPENDENCIES
byebug
coffee-rails (~> 4.1.0)
dotenv-rails
faker
gemoji
haml-rails (~> 0.9)
jbuilder (~> 2.0)
Expand Down
16 changes: 16 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,19 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)

10.times do
User.create(
name: Faker::Name.name,
email: "#{Faker::Internet.email.split("@").first}@#{ENV['EMAIL_WHITELIST']}",
image: Faker::Avatar.image
)
end

20.times do
Compliment.create(
complimenter: User.order("RANDOM()").first,
complimentee: User.order("RANDOM()").first,
text: Faker::Lorem.sentence
)
end

0 comments on commit ee5107c

Please sign in to comment.