提交 02622189 编写于 作者: S Santiago Pastorino

Add f.submit to forms just to show the most common use case

上级 bdf70fd3
......@@ -112,6 +112,7 @@ module FormHelper
# <%= f.text_field :version %><br />
# <%= f.label :author, 'Author' %>:
# <%= f.text_field :author %><br />
# <%= f.submit %>
# <% end %>
#
# There, +form_for+ is able to generate the rest of RESTful form
......@@ -129,6 +130,7 @@ module FormHelper
# Last name : <%= f.text_field :last_name %><br />
# Biography : <%= f.text_area :biography %><br />
# Admin? : <%= f.check_box :admin %><br />
# <%= f.submit %>
# <% end %>
#
# There, the argument is a symbol or string with the name of the
......@@ -160,6 +162,7 @@ module FormHelper
# Last name : <%= f.text_field :last_name %>
# Biography : <%= text_area :person, :biography %>
# Admin? : <%= check_box_tag "person[admin]", @person.company.admin? %>
# <%= f.submit %>
# <% end %>
#
# This also works for the methods in FormOptionHelper and DateHelper that
......@@ -271,6 +274,7 @@ module FormHelper
# <%= f.text_field :last_name %>
# <%= f.text_area :biography %>
# <%= f.check_box :admin %>
# <%= f.submit %>
# <% end %>
#
# In this case, if you use this:
......@@ -347,6 +351,8 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# <%= fields_for @person.permission do |permission_fields| %>
# Admin? : <%= permission_fields.check_box :admin %>
# <% end %>
#
# <%= f.submit %>
# <% end %>
#
# ...or if you have an object that needs to be represented as a different
......@@ -408,6 +414,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# Street : <%= address_fields.text_field :street %>
# Zip code: <%= address_fields.text_field :zip_code %>
# <% end %>
# ...
# <% end %>
#
# When address is already an association on a Person you can use
......@@ -437,6 +444,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# ...
# Delete: <%= address_fields.check_box :_destroy %>
# <% end %>
# ...
# <% end %>
#
# ==== One-to-many
......@@ -466,6 +474,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# Name: <%= project_fields.text_field :name %>
# <% end %>
# <% end %>
# ...
# <% end %>
#
# It's also possible to specify the instance to be used:
......@@ -479,6 +488,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# <% end %>
# <% end %>
# <% end %>
# ...
# <% end %>
#
# Or a collection to be used:
......@@ -488,6 +498,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# <%= person_form.fields_for :projects, @active_projects do |project_fields| %>
# Name: <%= project_fields.text_field :name %>
# <% end %>
# ...
# <% end %>
#
# When projects is already an association on Person you can use
......@@ -517,6 +528,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# <%= person_form.fields_for :projects do |project_fields| %>
# Delete: <%= project_fields.check_box :_destroy %>
# <% end %>
# ...
# <% end %>
def fields_for(record, record_object = nil, options = nil, &block)
capture(instantiate_builder(record, record_object, options, &block), &block)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册