Merge pull request #4976 from dmacjam/fix_generate_posts

FIX: user is nil in populate command
This commit is contained in:
Régis Hanol 2017-07-16 11:11:35 +02:00 committed by GitHub
commit ad0e43507b
1 changed files with 2 additions and 1 deletions

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