Sha256: 8574b7b7acb035a7e6f59ff9e99c3dfab57a365578ef5dfb27eaf2997baa5235

Contents?: true

Size: 522 Bytes

Versions: 16

Compression:

Stored size: 522 Bytes

Contents

namespace :db do
  desc "Fill database with sample data"
  task populate: :environment do
    make_people
  end
end    

def make_people
  75.times do |n|
    last_name = Faker::Name.last_name
    first_name = Faker::Name.first_name
    email = Faker::Internet.email
    title = "Sales Rep" #Faker::Name.title
    dob = Time.now - Random.rand(3_000..15_000).days
    is_manager = false
    Person.create!(last_name: last_name, first_name: first_name, is_manager: is_manager, dob: dob, title: title, email: email)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
controller_scaffolding-1.4.4 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.4.3 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.4.2 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.4.1 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.4.0 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.3.0 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.2.0 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.1.1 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.1.0 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.0.4 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.0.3 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.0.2 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.0.1 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-1.0.0 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-0.1.5 test/dummy/lib/tasks/sample_data.rake
controller_scaffolding-0.0.52 test/dummy/lib/tasks/sample_data.rake