aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-21 16:59:04 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-21 16:59:04 +0000
commit8e56e09018d658393692d3b4c3b1e0c248fd01ca (patch)
treebac572e7495f70a75f11fc8eed25aea754590ae0 /actionpack/lib
parent964a477340b9deef6a629168bd393e7168b4ab14 (diff)
downloadrails-8e56e09018d658393692d3b4c3b1e0c248fd01ca.tar.gz
rails-8e56e09018d658393692d3b4c3b1e0c248fd01ca.tar.bz2
rails-8e56e09018d658393692d3b4c3b1e0c248fd01ca.zip
Updated documentation for partials #1171
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/partials.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb
index 35691aaf81..fe2b4be79c 100644
--- a/actionpack/lib/action_view/partials.rb
+++ b/actionpack/lib/action_view/partials.rb
@@ -5,17 +5,17 @@ module ActionView
#
# In a template for Advertiser#account:
#
- # <%= render_partial "account" %>
+ # <%= render :partial => "account" %>
#
# This would render "advertiser/_account.rhtml" and pass the instance variable @account in as a local variable +account+ to
# the template for display.
#
# In another template for Advertiser#buy, we could have:
#
- # <%= render_partial "account", :account => @buyer %>
+ # <%= render :partial => "account", :locals => { :account => @buyer } %>
#
# <% for ad in @advertisements %>
- # <%= render_partial "ad", :ad => ad %>
+ # <%= render :partial => "ad", :locals => { :ad => ad } %>
# <% end %>
#
# This would first render "advertiser/_account.rhtml" with @buyer passed in as the local variable +account+, then render
@@ -28,7 +28,7 @@ module ActionView
# a partial by the same name as the elements contained within. So the three-lined example in "Using partials" can be rewritten
# with a single line:
#
- # <%= render_partial_collection "ad", @advertisements %>
+ # <%= render :partial => "ad", :collection => @advertisements %>
#
# This will render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. An iteration counter
# will automatically be made available to the template with a name of the form +partial_name_counter+. In the case of the
@@ -38,11 +38,12 @@ module ActionView
#
# Two controllers can share a set of partials and render them like this:
#
- # <%= render_partial "advertisement/ad", :ad => @advertisement %>
+ # <%= render :partial => "advertisement/ad", :locals => { :ad => @advertisement } %>
#
# This will render the partial "advertisement/_ad.rhtml" regardless of which controller this is being called from.
module Partials
- def render_partial(partial_path, local_assigns = {}, deprecated_local_assigns = {})
+ # Deprecated, use render :partial
+ def render_partial(partial_path, local_assigns = {}, deprecated_local_assigns = {}) #:nodoc:
path, partial_name = partial_pieces(partial_path)
object = extracting_object(partial_name, local_assigns, deprecated_local_assigns)
local_assigns = extract_local_assigns(local_assigns, deprecated_local_assigns)
@@ -51,7 +52,8 @@ module ActionView
render("#{path}/_#{partial_name}", { partial_name => object }.merge(local_assigns))
end
- def render_partial_collection(partial_name, collection, partial_spacer_template = nil, local_assigns = {})
+ # Deprecated, use render :partial, :collection
+ def render_partial_collection(partial_name, collection, partial_spacer_template = nil, local_assigns = {}) #:nodoc:
collection_of_partials = Array.new
counter_name = partial_counter_name(partial_name)
collection.each_with_index do |element, counter|