DEV: prevents populate task to crash (#8111)

Generated emails/names/sentences were crashing with the following error:

```
Can not transliterate strings with ASCII-8BIT encoding
```
This commit is contained in:
Joffrey JAFFEUX 2019-09-22 05:18:48 -07:00 committed by GitHub
parent 301c5a303f
commit cb8fa46970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,11 +102,13 @@ class Populate < Thor
end
def generate_sentence(num_words)
hipster_words.sample(num_words).join(' ').capitalize + '.'
sentence = hipster_words.sample(num_words).join(' ').capitalize + '.'
sentence.force_encoding('UTF-8')
end
def generate_email
hipster_words.sample.delete(' ') + '@' + hipster_words.sample.delete(' ') + '.com'
email = hipster_words.sample.delete(' ') + '@' + hipster_words.sample.delete(' ') + '.com'
email.delete("'").force_encoding('UTF-8')
end
def image_posts