Paperclip failing to upload on specific scaffold, yet works on others
- by Saifis
I know there are tons of questions about paperclip, but I failed to find the answer to my problem.
I know its prob just something simple, but I I'm running out of hair to pull out.
I have paperclip working on other parts of my project, they work with no problem, however, a certain scaffold fails to upload, all the attributes to the uploaded file are nil.
Here are the relevant information.
Model:
has_attached_file :foo,
:styles => { :thumb => "140x140>" },
:url => "/data/:id/:style/:basename.:extension",
:path => ":rails_root/public/data/:id/:style/:basename.:extension"
View:
<% form_for(@bar, :html => { :multipart => true }) do |f| %>
<%= f.error_messages %>
----------
<li><%= f.label :top %>
<%= f.file_field :foo %></li>
----------
<ul><%= f.submit "Save" %></ul>
<% end %>
Also, comparing the logs to the parts that work, the :foo attribute seems to be passing different values than in the ones that work.
In the logs, when the paperclip function works, it looks like this
"image"=>#<File:/var/folders/M5/M5HEb+WhFxmqNDGH5s-pNE+++TI/-Tmp-/RackMultipart20100512-1302-5e2e6e-0>
when it does not, it seems to pass the file name directly
"foo"=>"foo_image.png"
I am developing locally on MacOSX using local rails and ruby libs.