Attachment_fu :uploaded_data

Hi.
In my Model DesignThumbnail I use Attachment_fu.

----------------- Model -------------------------------
class DesignThumbnail < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 150.kilobytes,
:resize_to => ‘86x170>’
validates_as_attachment

end

Instead of uploading the image with a form I want to use a stored image.

----------------- Controller -----------
@thumb = DesignThumbnail.new
@thumb.uploaded_data =
File.open("#{RAILS_ROOT}/public/images/sample.jpg")

if @thumb.save
flash[:notice] = ‘Image was successfully created.’
redirect_to …
else
render …
end

I receive the error message
“undefined method `size’ for #<File:0x2aaaacf79118>”

vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:288:in
`uploaded_data=’

thanks
Michael

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