Skip to content
Pierre Merlin edited this page Oct 22, 2019 · 3 revisions

Welcome to the seed-fu wiki!

How to seed a file if you have a model that uses Paperclip:

I created a directory called 'simages' with the files to seed, though it could be anywhere (public/images, test/fixtures etc.). Then it's just:


  s.logo = File.new("#{Rails.root}/simages/logo.jpg")

How to dump existing data :

Using an existing table to programmatically create initial seed fu data definition

locations = CountryLocation.all
SeedFu::Writer.write("db/fixtures/country_locations.rb", class_name: "CountryLocation", :constraints => [:id]) do |writer|
  locations.each do |l|
    writer.add(id: l.id, iso: l.iso, name: l.name, printable_name: l.printable_name, iso3: l.iso3, numcode: l.numcode, email: l.email)
  end
end