From ca9413674ea70dc67ab517734af2e40dac21beef Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 26 Mar 2008 12:27:52 +0000 Subject: Improve documentation. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/atom_feed_helper.rb | 2 +- actionpack/lib/action_view/helpers/form_helper.rb | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/actionpack/lib/action_view/helpers/atom_feed_helper.rb index 5aaf1b4688..ebb1cb34bc 100644 --- a/actionpack/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionpack/lib/action_view/helpers/atom_feed_helper.rb @@ -49,7 +49,7 @@ module ActionView # * :url: The URL for this feed. Defaults to the current URL. # * :schema_date: The date at which the tag scheme for the feed was first used. A good default is the year you # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified, - # 2005 is used (as a "I don't care"-value). + # 2005 is used (as an "I don't care" value). # # Other namespaces can be added to the root element: # diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 22c6562cc7..0e77a7e067 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -76,6 +76,7 @@ module ActionView # values for the fields. # # <% form_for :person, @person, :url => { :action => "update" } do |f| %> + # <%= f.error_messages %> # First name: <%= f.text_field :first_name %> # Last name : <%= f.text_field :last_name %> # Biography : <%= f.text_area :biography %> @@ -85,7 +86,8 @@ module ActionView # Worth noting is that the form_for tag is called in a ERb evaluation block, not an ERb output block. So that's <% %>, # not <%= %>. Also worth noting is that form_for yields a form_builder object, in this example as f, which emulates # the API for the stand-alone FormHelper methods, but without the object name. So instead of text_field :person, :name, - # you get away with f.text_field :name. + # you get away with f.text_field :name. Notice that you can even do <%= f.error_messages %> to display the + # error messsages of the model object in question. # # Even further, the form_for method allows you to more easily escape the instance variable convention. So while the stand-alone # approach would require text_field :person, :name, :object => person @@ -405,7 +407,7 @@ module ActionView # ==== Examples # # Let's say that @post.validated? is 1: # check_box("post", "validated") - # # => + # # => # # # # # Let's say that @puppy.gooddog is "no": @@ -413,8 +415,8 @@ module ActionView # # => # # # - # check_box("eula", "accepted", {}, "yes", "no", :class => 'eula_check') - # # => + # check_box("eula", "accepted", { :class => 'eula_check' }, "yes", "no") + # # => # # # def check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0") @@ -430,13 +432,13 @@ module ActionView # # Let's say that @post.category returns "rails": # radio_button("post", "category", "rails") # radio_button("post", "category", "java") - # # => - # # + # # => + # # # # radio_button("user", "receive_newsletter", "yes") # radio_button("user", "receive_newsletter", "no") - # # => - # # + # # => + # # def radio_button(object_name, method, tag_value, options = {}) InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_radio_button_tag(tag_value, options) end -- cgit v1.2.3