Sha256: 26248691d94b9ac5fbd91115a0be58a14c25df82cc42d0be4f3c145a05e0c0c1

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

class Populate

  def self.populate
    require 'populator'
    require 'faker'

    Account.populate 20 do |account|
      account.name = Faker::Company.name
      account.users_count = rand(100)
    end

    Comment.populate 500 do |comment|
      comment.user_id = rand(100)
      comment.comment = Populator.sentences(2..10)
    end

    Contact.populate 200 do |contact|
      contact.name =  Faker::Name.name
      contact.email = Faker::Internet.email
      contact.message = Populator.sentences(2..10)
    end

    User.populate 100 do |user|
      user.name = Faker::Name.name
      user.age = rand(99)
      user.salary = rand(5000)
      user.bio = Populator.sentences(2..10)
      user.account_id = rand(3)
      user.dob = Date.today - rand(10000).days
    end

    Project.populate 100 do |project|
      project.name = Faker::Company.name
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_db-0.5.1 test/dummy/app/models/populate.rb
rails_db-0.5 test/dummy/app/models/populate.rb
rails_db-0.4 test/dummy/app/models/populate.rb
rails_db-0.3 test/dummy/app/models/populate.rb