-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Neil Gehani
committed
Sep 20, 2013
1 parent
966e221
commit d9a9b42
Showing
5 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ doc/ | |
|
||
# Ignore Paperclip uploaded images | ||
/public/system | ||
|
||
# Ignore sampleimages | ||
/sampleimage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace :db do | ||
desc "Fill database with sample data" | ||
task populate: :environment do | ||
10.times do |n| | ||
puts "[DEBUG] creating user #{n+1} of 10" | ||
name = Faker::Name.name | ||
email = "user-#{n+1}@example.com" | ||
password = "password" | ||
User.create!( name: name, | ||
email: email, | ||
password: password, | ||
password_confirmation: password) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace :db do | ||
desc "Fill database with sample data" | ||
task populateimage: :environment do | ||
|
||
User.all.each do |user| | ||
puts "[DEBUG] uploading images for user #{user.id} of #{User.last.id}" | ||
10.times do |n| | ||
image = File.open(Dir.glob(File.join(Rails.root, 'sampleimage', '*')).sample) | ||
description = %w(cool awesome crazy wow adorbs incredible).sample | ||
user.pins.create!(image: image, description: description) | ||
end | ||
end | ||
end | ||
end |