file_field is not sticky in my Rails form
- by Tony
I have a pretty standard Rails form:
<div>
<h1>Create a New Listing</h1>
<%- form_for @listing, :html => {:multipart => true} do |f| -%>
<div><%= f.label :title, "Title:"%> <%= f.text_field :title %></div>
<div>
<%= f.label :image, "Image:" %> <%= f.file_field :image
</div>
<div>
<%= f.label :sound, "Sound Clip:"%> <%= f.file_field :sound %><br />
</div>
<div class="submit"><%= f.submit 'Post Listing' %></div>
<%- end -%>
</div>
When a user chooses a file, but the form fails for validation purposes, he must always re-select the file. It is not sticky. Any suggestion on how to fix this?
Thanks!