Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Faker gem: possible to seed with stylized text?

I use the Faker gem to seed my db with fake data. For some variables I for example use Faker::Lorem.paragraph(4). But what I would really want is to seed with text that has styling in it. Such as <p></p><b> etc. Is this possible with the Faker gem?

like image 918
Nick Avatar asked Oct 27 '25 14:10

Nick


1 Answers

You can use Faker::Lorem.paragraphs(4). It returns an array, which you can then modify as needed. Like:

Faker::Lorem.paragraphs(4).map{|pr| "<p>#{pr}</p>"}.join
like image 95
Babar Al-Amin Avatar answered Oct 30 '25 07:10

Babar Al-Amin