Skip to content

Instantly share code, notes, and snippets.

@palkan
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palkan/731e27c44d730e13ce32 to your computer and use it in GitHub Desktop.
Save palkan/731e27c44d730e13ce32 to your computer and use it in GitHub Desktop.
NestedForm + CarrierWave
= nested_form_for answer, remote: true, ... do |f|
...
= f.fields_for :attachments do |attachment_form|
- if attachment_form.object.file.present?
p = attachment_form.object.file.identifier
- else
= attachment_form.label :file
= attachment_form.file_field :file
= attachment_form.link_to_remove "Remove this file"
= f.link_to_add "Add file", :attachments
= f.submit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment