From f97832b1e4406a76d268a96b521d2297adec0ae3 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Tue, 24 Mar 2009 12:15:43 +0000 Subject: Merge docrails --- railties/guides/source/active_record_querying.textile | 1 - railties/guides/source/form_helpers.textile | 2 +- railties/guides/source/layouts_and_rendering.textile | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 442521cbf4..b112c4f5fb 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -111,7 +111,6 @@ h5. +last+ Model.last(options = nil) finds the last record matched by the supplied options. If no +options+ are supplied, the last matching record is returned. For example: -# Find the client with primary key (id) 10. client = Client.last => # "Russel"> diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 9ab4deff4e..22d24b0903 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -683,7 +683,7 @@ This would result in +params[:addresses]+ being an array of hashes with keys +li There's a restriction, however, while hashes can be nested arbitrarily, only one level of "arrayness" is allowed. Arrays can be usually replaced by hashes, for example instead of having an array of model objects one can have a hash of model objects keyed by their id, an array index or some other parameter. -WARNING: Array parameters do not play well with the +check_box+ helper. According to the HTML specification unchecked checkboxes submit no value. However it is often convenient for a checkbox to always submit a value. The +check_box+ helper fakes this by creating a second hidden input with the same name. If the checkbox is unchecked only the hidden input is submitted and if it is checked then both are submitted but the value submitted by the checkbox takes precedence. When working with array parameters this duplicate submission will confuse Rails since duplicate input names are how it decides when to start a new array element. It is preferable to either use +check_box_tag+ or to use hashes instead of arrays. +WARNING: Array parameters do not play well with the +check_box+ helper. According to the HTML specification unchecked checkboxes submit no value. However it is often convenient for a checkbox to always submit a value. The +check_box+ helper fakes this by creating an auxiliary hidden input with the same name. If the checkbox is unchecked only the hidden input is submitted and if it is checked then both are submitted but the value submitted by the checkbox takes precedence. When working with array parameters this duplicate submission will confuse Rails since duplicate input names are how it decides when to start a new array element. It is preferable to either use +check_box_tag+ or to use hashes instead of arrays. h4. Using Form Helpers diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index 69faa1b449..809d2b2172 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -959,7 +959,7 @@ On pages generated by +NewsController+, you want to hide the top menu and add a
Right menu items here
<%= yield(:news_content) or yield %> <% end -%> -<% render :file => 'layouts/application' %> +<%= render :file => 'layouts/application' %> That's it. The News views will use the new layout, hiding the top menu and adding a new right menu inside the "content" div. -- cgit v1.2.3