I don't think Faker methods accept range as arguments. In doc it only accepts numbers. Thus I can't even reproduce your problem in console by copying your code.
Maybe you want to generate words or paragraphs in random length? You can use rand
to generate it. Like this:
title = Faker::Lorem.words(number: rand(2..10))
body = Faker::Lorem.paragraphs(sentence_count: rand(2..8))
Update
Faker will create HASH instead of plain string.
So, for your title, you'd better use sentence
instead of words
and then chomp the last .
title = Faker::Lorem.sentence(word_count: rand(2..10)).chomp('.')
# or
title = Faker::Lorem.words(number: rand(2..10)).join(' ')
For body, join the paragraphs with \n
or whatever you like
body = Faker::Lorem.paragraphs(sentence_count: rand(2..8)).join('\n')
Update 2
Positional keywords deprecated in favour of keyword arguments in Faker 2.0 in 2019