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 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 User.create! username: "admin", email: "admin@email.com", password: "azerty", admin: true puts "Created Admin" 30.times do |i| task = Task.create( name: Faker::Fantasy::Tolkien.character, description: Faker::Fantasy::Tolkien.poem, duration: rand(1..120), user_id: User.all.sample.id, activity_id: Activity.all.sample.id ) puts "Created TASK ##{i} - #{task.name}" end