I’ve had a few guys email me asking if I had any idea why Paperclip wasn’t saving their uploaded images. Here’s a form one of them sent me:
<% form_for(@post) do |f| %> <%= f.error_messages %> <%= f.label :title %> <%= f.text_field :title %> <%= f.label :description %> <%= f.text_area :description %> <%= f.file_field :image %> <%= f.submit "Update" %> <% end %>
Notice anything different on this form?
<% form_for(@post, :html => { :multipart => true }) do |f| %> <%= f.error_messages %> <%= f.label :title %> <%= f.text_field :title %> <%= f.label :description %> <%= f.text_area :description %> <%= f.file_field :image %> <%= f.submit "Update" %> <% end %>
Simple mistake, but I’ve done it a few times in the early AM and wondered WTF was going on!
:html => { :multipart => true