aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-18 17:40:58 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-18 17:40:58 -0200
commit02b955766e5094c1f0afac04f415632e0463eea8 (patch)
tree35da447bcb37cf875e37dc0fedb042f74e1a4483 /actionview
parente07eb079bf6911e520edfb8a40677aa26a4987de (diff)
downloadrails-02b955766e5094c1f0afac04f415632e0463eea8.tar.gz
rails-02b955766e5094c1f0afac04f415632e0463eea8.tar.bz2
rails-02b955766e5094c1f0afac04f415632e0463eea8.zip
Improve documentation of local_assigns
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/template.rb20
1 files changed, 13 insertions, 7 deletions
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.
#