Rake db:seed complains about form not being multipart encoded

I’m using CarrierWave to attach icons to my activities model. I have a
bunch of seed data that I want to create every time I recreate my

The following line from my seeds.rb file causes rake to throw and

activity = Activity.create! :name => ‘Football’, :icon =>

As you can see, I’m trying to upload a file from my public directory
when I run rake db:seed.

But when I do this, I get a complaint about my form not being
multipart encoded. I know that my form IS multipart encoded because
manual uploads work fine and I’ve added the necessary code i.e. (:html
=> {:multipart => true}) to my form

I’m guessing that this is not a CarrierWave issue since it would
almost certainly happen if I was using paperclip or attachment_fu but
perhaps some of you have dealt with this issue before?

It seems to me that rake is not using the same form that is used for
manual uploads (makes sense really) so is there a way to tell rake
that this seed data should be considered multipart encoded?

Managed to fix this thanks to the following question on stack
ruby - Seeding file uploads with CarrierWave, Rails 3 - Stack Overflow

Just had to fix the code in my seeds file a bit. The following

activity = Activity.create! :name => ‘Football’, :icon =>
File.open(File.join(Rails.root, ‘/public/images/activity_icons/

On Nov 18, 1:57am, stephenjamesmurdoch