From 0262218976b29630c9a2b77cf3cf03deae21614f Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 14 Nov 2010 21:40:34 -0200 Subject: Add f.submit to forms just to show the most common use case --- actionpack/lib/action_view/helpers/form_helper.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f77b138bc6..8c300ec745 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -112,6 +112,7 @@ module ActionView # <%= f.text_field :version %>
# <%= f.label :author, 'Author' %>: # <%= f.text_field :author %>
+ # <%= 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 %>
# Biography : <%= f.text_area :biography %>
# Admin? : <%= f.check_box :admin %>
+ # <%= 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) -- cgit v1.2.3