1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

add <%= to fields_for examples

This commit is contained in:
eparreno 2010-05-28 16:46:12 +02:00
parent ddec74fb3a
commit 6330e2af11
3 changed files with 4 additions and 4 deletions

View file

@ -699,7 +699,7 @@ Creates a scope around a specific model object like form_for, but doesnt crea
First name: <%= person_form.text_field :first_name %>
Last name : <%= person_form.text_field :last_name %>
<% fields_for @person.permission do |permission_fields| %>
<%= fields_for @person.permission do |permission_fields| %>
Admin? : <%= permission_fields.check_box :admin %>
<% end %>
<% end %>

View file

@ -1342,7 +1342,7 @@ We also add a <tt>@post.tags.build</tt> at the top of this form, this is to make
Now create the folder <tt>app/views/tags</tt> and make a file in there called <tt>_form.html.erb</tt> which contains the form for the tag:
<erb>
<% form.fields_for :tags do |tag_form| %>
<%= form.fields_for :tags do |tag_form| %>
<div class="field">
<%= tag_form.label :name, 'Tag:' %>
<%= tag_form.text_field :name %>

View file

@ -143,7 +143,7 @@ Now add a nested form for the +address+ association:
<%= form_for @person do |f| %>
<%= f.text_field :name %>
<% f.fields_for :address do |af| %>
<%= f.fields_for :address do |af| %>
<%= f.text_field :street %>
<% end %>
<% end %>
@ -184,7 +184,7 @@ The form code for an association collection is pretty similar to that of a singl
<%= form_for @person do |f| %>
<%= f.text_field :name %>
<% f.fields_for :projects do |pf| %>
<%= f.fields_for :projects do |pf| %>
<%= f.text_field :name %>
<% end %>
<% end %>