Rake: uninitialized const ActionController::TestUploadedFile

Hi,

My app uses attachment_fu and I’d like to pre-load some data via a rake
task.

Thus:

[code]desc “Upload template files”
task :upload_files_test => :environment do |t|
conf = Conference.find(1)

[{:f => ‘styles.css’, :type_code => ‘css’, :content_type =>
‘text/css’}].each do |i|
file =
ActionController::TestUploadedFile.new(“db/migrate/widgets_layout/” +
i[:f], i[:content_type])
conf.conference_files.create(:uploaded_data => file)
end
end[/code]

But I get the rake error
uninitialized constant ActionController::TestUploadedFile

If I start the console, ActionController::TestUploadedFile.new works
fine.

Thank you for any ideas,

Larry

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs