123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- User.delete_all
- User.reset_pk_sequence
- Activity.delete_all
- Activity.reset_pk_sequence
- JoinedUserActivity.delete_all
- JoinedUserActivity.reset_pk_sequence
- Task.delete_all
- Task.reset_pk_sequence
- Record.delete_all
- Record.reset_pk_sequence
-
- 10.times do |i|
- name = Faker::Name.first_name.downcase
- user = User.create! username: "#{name}", email: "#{name}@email.com", password: "azerty"
- puts "Created USER ##{i} - #{user.username}"
-
- 2.times do
- activity = Activity.create!(
- name: Faker::Science.element,
- client: Faker::Company.name,
- description: Faker::Company.catch_phrase,
- author_id: user.id
- )
- puts "Created ACTIVITY \"#{activity.name}\" for #{activity.client}"
-
- joined_user_activity = JoinedUserActivity.create!(
- user_id: user.id,
- activity_id: activity.id
- )
- puts "Created ASSOCIATION ##{joined_user_activity.id}"
- end
- end
-
- 30.times do |i|
- task = Task.create(
- name: Faker::Fantasy::Tolkien.character,
- description: Faker::Fantasy::Tolkien.poem,
- user_id: User.all.sample.id,
- activity_id: Activity.all.sample.id
- )
- puts "Created TASK ##{i} - #{task.name}"
- end
-
- 20.times do |i|
- record = Record.create(
- duration: rand(60..480),
- user_id: User.all.sample.id,
- task_id: Task.all.sample.id
- )
- puts "Created RECORD ##{i}"
- end
|