diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-04 20:01:52 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-04 20:01:52 +0000 |
commit | df70e28e037952c8dee8e66b3ae683e5976e4f1d (patch) | |
tree | 6e96f8c46c8c42b3f1e3ce952a4d72a3ca93d383 /actionpack/test | |
parent | 939017487d6fb3ad255f98079deadcef1e4054b0 (diff) | |
download | rails-df70e28e037952c8dee8e66b3ae683e5976e4f1d.tar.gz rails-df70e28e037952c8dee8e66b3ae683e5976e4f1d.tar.bz2 rails-df70e28e037952c8dee8e66b3ae683e5976e4f1d.zip |
Added locals hash to partials, which makes for convenient access of some times available/some times not variables (closes #5491) [wbruce@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4997 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index c22702acd0..12340e56a6 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -93,6 +93,28 @@ class TestController < ActionController::Base ActionView::Base.local_assigns_support_string_keys = false end + def accessing_locals_hash_in_inline_template + name = params[:local_name] + render :inline => "<%= 'Goodbye, ' + locals[:local_name] %>", + :locals => { :local_name => name } + end + + def accessing_locals_hash_in_inline_template_setting_string_key + name = params[:local_name] + ActionView::Base.local_assigns_support_string_keys = true + render :inline => "<%= 'Goodbye, ' + locals[:local_name] %>", + :locals => { "local_name" => name } + ActionView::Base.local_assigns_support_string_keys = false + end + + def accessing_locals_hash_in_inline_template_getting_string_key + name = params[:local_name] + ActionView::Base.local_assigns_support_string_keys = true + render :inline => "<%= 'Goodbye, ' + locals['local_name'] %>", + :locals => { :local_name => name } + ActionView::Base.local_assigns_support_string_keys = false + end + def render_to_string_test @foo = render_to_string :inline => "this is a test" end |