Skip to content

Instantly share code, notes, and snippets.

@linjunpop
Created October 24, 2012 09:07
Show Gist options
  • Select an option

  • Save linjunpop/3944995 to your computer and use it in GitHub Desktop.

Select an option

Save linjunpop/3944995 to your computer and use it in GitHub Desktop.
Nested form and twitter bootstrap css.
- if f.object.file?
= f.input :file, label: false, wrapper: :append do
= f.input_field :file, as: :string, readonly: true
span
= link_to 'Download', f.object.file_url, class: 'btn'
= f.link_to_remove 'Remove document', class: 'btn btn-danger'
- else
= f.input :file, label: false, wrapper: :append do
= f.input_field :file, as: :file
span
= f.link_to_remove 'Remove document', class: 'btn btn-danger'
= simple_nested_form_for(@vehicle, html: {class: 'form-inline'}) do |f|
= f.fields_for :documents
= f.link_to_add "Add a document", :documents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment