-
Notifications
You must be signed in to change notification settings - Fork 155
Home
Pierre Merlin edited this page Oct 22, 2019
·
3 revisions
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")
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