Skip to content

Instantly share code, notes, and snippets.

@8vius
Created August 22, 2012 16:42
Show Gist options
  • Save 8vius/3427313 to your computer and use it in GitHub Desktop.
Save 8vius/3427313 to your computer and use it in GitHub Desktop.
namespace :db do
desc "Fill database with sample data"
task populate: :environment do
User.create!(name: "Example User",
email: "example@railstutorial.org",
password: "foobar",
password_confirmation: "foobar")
99.times do |n|
name = Faker::Name.name
email = "example-#{n+1}@railstutorial.org"
password = "password"
User.create!(name: name,
email: email,
password: password,
password_confirmation: password)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment