mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add f.submit to forms just to show the most common use case
This commit is contained in:
@@ -112,6 +112,7 @@ module ActionView
|
||||
# <%= 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 ActionView
|
||||
# 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 ActionView
|
||||
# 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 ActionView
|
||||
# <%= 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 @@ module ActionView
|
||||
# <%= 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 @@ module ActionView
|
||||
# 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 @@ module ActionView
|
||||
# ...
|
||||
# Delete: <%= address_fields.check_box :_destroy %>
|
||||
# <% end %>
|
||||
# ...
|
||||
# <% end %>
|
||||
#
|
||||
# ==== One-to-many
|
||||
@@ -466,6 +474,7 @@ module ActionView
|
||||
# Name: <%= project_fields.text_field :name %>
|
||||
# <% end %>
|
||||
# <% end %>
|
||||
# ...
|
||||
# <% end %>
|
||||
#
|
||||
# It's also possible to specify the instance to be used:
|
||||
@@ -479,6 +488,7 @@ module ActionView
|
||||
# <% end %>
|
||||
# <% end %>
|
||||
# <% end %>
|
||||
# ...
|
||||
# <% end %>
|
||||
#
|
||||
# Or a collection to be used:
|
||||
@@ -488,6 +498,7 @@ module ActionView
|
||||
# <%= 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 @@ module ActionView
|
||||
# <%= 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)
|
||||
|
||||
Reference in New Issue
Block a user