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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I was having an issue with uploading issues Windows but you might want to check
out http://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-like.html
----- Original Message ----
From: Michael ..
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---