Skip to content

Instantly share code, notes, and snippets.

@jalberto
Created April 7, 2012 12:11
Show Gist options
  • Save jalberto/2328270 to your computer and use it in GitHub Desktop.
Save jalberto/2328270 to your computer and use it in GitHub Desktop.
dynamic form with cocoon
= semantic_form_for(@event, :html => {:multipart => true, :id => "logoUpload", :'data-ajax' => false}) do |f|
= f.inputs do
= f.input(:logo, :as => :file)
= f.input(:logo_cache, :as => :hidden)
= f.input(:name)
= f.input(:info)
#matches
= f.inputs :for => [:matches] do |mf|
= render :partial => 'match_fields', :locals => {:f => mf}
.links
= link_to_add_association 'add match', f, :matches
= f.buttons
.nested-fields
= f.inputs do
= f.input(:score)
= f.input(:date, :as => :date)
= link_to_remove_association "remove match", f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment