Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rails: Seed database with remote Faker images and CarrierWave
# We need to use 'remote_<object>_url' as attribute instead of '<object>'.
# Having Image, we would use 'remote_image_url: <url>'.
titles = [, Faker::BossaNova.artist, Faker::Book.title]
54.times do |n|
start_date = Faker::Date.between(, 6.months.from_now)
end_date = start_date +
Event.create!(title: titles.sample + " ##{n}",
description: Faker::Lorem.paragraph,
start_date: start_date,
end_date: end_date,
remote_image_url: Faker::LoremPixel.image("730x411"),
organizer_id: )

This comment has been minimized.

Copy link

@ghost ghost commented Mar 2, 2020

Hey there! Working on something similar but for Rails 6, any chance you could have a look?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment