Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created March 20, 2013 15:26
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 leemcalilly/51e7c5c7e6c4788ad000 to your computer and use it in GitHub Desktop.
Save leemcalilly/51e7c5c7e6c4788ad000 to your computer and use it in GitHub Desktop.
<%= simple_nested_form_for @album, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<legend><%= controller.action_name.capitalize %></legend>
<%= f.error_notification %>
<%= f.input :title %>
<%= f.input :year, :collection => Date.today.year.downto(Date.today.year - 90) %>
<%= f.input :artist %>
<%= f.input :credits %>
<%= f.simple_fields_for :songs do |song_form| %>
<%= song_form.association :songs %>
<%= song_form.link_to_remove "Remove this song" %>
<% end %>
<p><%= f.link_to_add "Add a song", :songs %></p>
<div class="form-actions">
<%= f.submit nil, :class => 'btn btn-primary' %>
<%= link_to 'Cancel', root_path, :class => 'btn' %>
</div>
</fieldset>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment