Skip to content

Instantly share code, notes, and snippets.

@flarnie
Created August 15, 2013 04:18
Show Gist options
  • Save flarnie/6238223 to your computer and use it in GitHub Desktop.
Save flarnie/6238223 to your computer and use it in GitHub Desktop.
A very basic example of a nested form.
<form action="<%= posts_url %>" method="post">
<label for="title">Title</label>
<input type="text" name="post[title]" value="<%= @post.title %>">
<br />
<label for="link_1">Link 1</label>
<input type="text" name="post[links_attributes][0][url]">>
<br />
<label for="link_2">Link 2</label>
<input type="text" name="post[links_attributes][1][url]">
<br />
<label for="link_3">Link 3</label>
<input type="text" name="post[links_attributes][2][url]">
<br />
<input type="submit" value="Update Post!">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment