TheeGrassHopper said over 3 years ago on ActiveRecord Tricks :
20.times do
  User.create! do |user|
    user.first_name = Faker::Name.first_name
    user.last_name = Faker::Name.last_name
    user.email = Faker::Internet.email
    user.status = Status.all.sample
  end
end
When I run the above in the console I get no errors but User.all is empty then Message.create! breaks with "ActiveRecord::RecordInvalid: Validation failed: User must exist" error. It's as if it never saves the Users to the database.