Skip to content

Instantly share code, notes, and snippets.

@dabit
Created July 9, 2019 16:04
Show Gist options
  • Save dabit/7f953a3e7ef6375c92edb2b5b0033011 to your computer and use it in GitHub Desktop.
Save dabit/7f953a3e7ef6375c92edb2b5b0033011 to your computer and use it in GitHub Desktop.
Trucos para desarrolladores
raise if Rails.env.production?
unless User.exists?(email: 'test@example.com')
organization = Organization.create!(name: 'Acme Inc', token: '12341234a')
user = User.create!(
email: 'test@example.com',
password: 'test123test',
role: :admin,
confirmed_at: Time.current,
organization: organization
)
10.times do |i|
user = organization.users.build(
email: Faker::Internet.email,
password: 'test123test',
role: :user
)
user.save!
work_profile = WorkProfile.new(full_name: Faker::Name.name,
start_date: (rand(30) + 30).days.ago,
user: user)
work_profile.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment