Created
March 4, 2009 11:08
-
-
Save josevalim/73798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What we had to do: | |
<% semantic_form_for @post do |form| %> | |
<%= form.inputs :title, :created_at %> | |
<% form.semantic_fields_for @post.author do |author_form| %> | |
<% author_form.inputs do %> | |
<%= author_form.input :name %> | |
<%= author_form.input :posts_count %> | |
<% end %> | |
<% end %> | |
<% end %> | |
# We could also do this: | |
<% semantic_form_for @post do |form| %> | |
<%= form.inputs :title, :created_at %> | |
<% form.semantic_fields_for @post.author do |author_form| %> | |
<%= author_form.inputs :name, :posts_count %> | |
<% end %> | |
<% end %> | |
# But now we can do this: | |
<% semantic_form_for @post do |form| %> | |
<%= form.inputs :title, :created_at %> | |
<% form.inputs :for => @post.author do |author_form| %> | |
<%= author_form.input :name %> | |
<%= author_form.input :posts_count %> | |
<% end %> | |
<% end %> | |
# Or even this: | |
<% semantic_form_for @post do |form| %> | |
<%= form.inputs :title, :created_at %> | |
<%= form.inputs :name, :posts_count, :for => @post.author %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment