Re: attachment_fu :uploaded_data

I was having an issue with uploading issues Windows but you might want
to check out

----- Original Message ----
From: Michael … [email protected]
To: [email protected]
Sent: Wednesday, March 19, 2008 10:18:31 AM
Subject: [Rails] 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

Posted via http://www.ruby-forum.com/.

Mark,

I had the same issue with ‘Size’ and I tried the patch from the url
that you posted. It works fine. But if i try to upload a file
with .JPG (note the uppercase extension), i still get an error
“Content type is not included in the list”. I tried including the
extension in the plugin but still did not work.

Is there any work around to fix this.

Thanks

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