I am trying to sow data in a Rails application, especially using a carrier. I use a combination of two good solutions found here in stackoverflow!
rake task + yml command for seeding
carrier wave seeder
I have the following:
namespace :db do desc "This loads the development data." task :seed => :environment do require 'active_record/fixtures' Dir.glob(RAILS_ROOT + '/db/fixtures/*.yml').each do |file| base_name = File.basename(file, '.*') puts "Loading #{base_name}..." ActiveRecord::Fixtures.create_fixtures('db/fixtures', base_name) end
However, in heroku, I keep getting errors about the path, for example
rake aborted! No such file or directory - app/assets/images/objects/house.svg
I tried several versions of the line:
item.filename.store!(File.open(File.join(Rails.root, "app/assets/images/objects/" + item.name.gsub(/ /,'').downcase + ".svg")))
where I basically changed the use of File.join and just concatenation, and also tried using RAILS_ROOT, which seemed to work fine above, but I always get this error.
source share