Skip to content

Instantly share code, notes, and snippets.

@bryanwongbh
Created December 18, 2012 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwongbh/4332780 to your computer and use it in GitHub Desktop.
Save bryanwongbh/4332780 to your computer and use it in GitHub Desktop.
Rails: Rake Create Dummy Users
#This is for Rake to create some dummy users in an app using Rails; sits within /lib/tasks/
namespace :db do
task populate: :environment do
User.create!(name: "Name",
email: "example@example.com",
password: "test123",
password_confirmation: "test123")
99.times do |n|
name = Faker::Name.name
email = "example-#{n+1}@example.com"
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