Fix user is nil in populate posts.

This commit is contained in:
Jakub Macina 2017-07-15 15:36:29 +02:00
parent 610728a70f
commit bdbde02d2c

View File

@ -60,7 +60,8 @@ class Populate < Thor
private
def create_user(user_email)
unless User.find_by_email(user_email)
user = User.find_by_email(user_email)
unless user
puts "Creating new account: #{user_email}"
user = User.create!(email: user_email, password: SecureRandom.hex, username: UserNameSuggester.suggest(user_email))
end