From 02b955766e5094c1f0afac04f415632e0463eea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 18 Feb 2015 17:40:58 -0200 Subject: Improve documentation of local_assigns --- actionview/lib/action_view/template.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 465022f714..2a4f8accaa 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -87,6 +87,19 @@ module ActionView # expected_encoding # ) + ## + # :method: local_assigns + # + # Returns a hash with the defined local variables. + # + # Given this sub template rendering: + # + # <%= render "shared/header", { headline: "Welcome", person: person } %> + # + # You can use +local_assigns+ in the sub templates to access the local variables: + # + # local_assigns[:headline] # => "Welcome" + eager_autoload do autoload :Error autoload :Handlers @@ -252,13 +265,6 @@ module ActionView end end - ## - # :method: local_assigns - # - # Returns a hash with the defined local variables - # - # local_assigns[:full] # => true - # Among other things, this method is responsible for properly setting # the encoding of the compiled template. # -- cgit v1.2.3