Skip to content

Instantly share code, notes, and snippets.

@beaucollins
Created August 31, 2009 16:03
Show Gist options
  • Save beaucollins/178532 to your computer and use it in GitHub Desktop.
Save beaucollins/178532 to your computer and use it in GitHub Desktop.
<%- form_for @album do |album_form| -%>
<!-- Album Form Stuff -->
<%-
# file_fields_for is where the magic happens. You supply the association to the model
# that has the 'attachment' as well as the property on that model that will receive
# the file upload data. This will take care of displaying the necessary upload fields
#
-%>
<%= album_form.attachment_fields_for :photos, :data %>
<%-
# If you need to display more than just a file field you can provide a block to the
# file_fields_for helper method, the file_fields_for method will take care of the dirty
# work and then you can supply and extra helper methods in the block
-%>
<%- album_form.attachment_fields_for :photos, :data do |photo_fields| -%>
<%= photo_fields.attachment_field %>
<%= photo_fields.checkbox :front %>
<%- end -%>
<%- end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment