Permalink
Browse files

Added more information about inputs :for in README.

Signed-off-by: Justin French <justin@indent.com.au>
  • Loading branch information...
1 parent 87647f1 commit 9997ce6268f1f703a690923260488b41756ff8f7 @josevalim josevalim committed with justinfrench Mar 7, 2009
Showing with 21 additions and 3 deletions.
  1. +21 −3 README.textile
View
@@ -14,7 +14,7 @@ One day, I finally had enough, so I opened up my text editor, and wrote a DSL fo
<%= form.input :body %>
<%= form.input :section %>
<%= form.input :publication_state, :as => :radio %>
- <%= form.input :author %>
+ <%= form.input :category %>
<%= form.input :allow_comments, :label => "Allow commenting on this article" %>
<% end %>
@@ -25,6 +25,11 @@ One day, I finally had enough, so I opened up my text editor, and wrote a DSL fo
<%= form.input :url_title, :required => false %>
<% end %>
+ <% form.inputs :for => :author do |author_form| %>
+ <%= form.input :first_name %>
+ <%= form.input :last_name %>
+ <% end %>
+
<% form.buttons do %>
<%= form.commit_button %>
<% end %>
@@ -151,13 +156,26 @@ If you want to customize the label text, or render some hint text below the fiel
<% end %>
</pre>
-Nested forms (Rails 2.3) are also supported:
+Nested forms (Rails 2.3) are also supported. You can do it in the Rails way:
<pre>
<% semantic_form_for @post do |post| %>
+ <%= post.inputs %>
+
<%= post.semantic_fields_for :author do |author| %>
- <%= author.inputs %>
+ <%= author.inputs :first_name, :last_name %>
<%= end %>
+
+ <%= post.buttons %>
+ <% end %>
+</pre>
+
+Or in the formtastic way:
+
+<pre>
+ <% semantic_form_for @post do |post| %>
+ <%= post.inputs %>
+ <%= post.inputs :first_name, :last_name, :for => :author %>
<%= post.buttons %>
<% end %>
</pre>

0 comments on commit 9997ce6

Please sign in to comment.