diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2005-10-16 00:04:33 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2005-10-16 00:04:33 +0000 |
commit | e625d276334bbfd1f0bc4359be2eea9fb75ae36a (patch) | |
tree | 3b52f95cc2250452a21a53eb0784a62511766477 /actionpack/lib | |
parent | 9369137676a482b2419028d00ec8255273ca8a00 (diff) | |
download | rails-e625d276334bbfd1f0bc4359be2eea9fb75ae36a.tar.gz rails-e625d276334bbfd1f0bc4359be2eea9fb75ae36a.tar.bz2 rails-e625d276334bbfd1f0bc4359be2eea9fb75ae36a.zip |
Add temporary support for passing locals to render using string keys
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2630 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index c65faeafbd..f9b35260bd 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -357,8 +357,11 @@ module ActionView #:nodoc: locals_keys = @@template_args[render_symbol].keys | locals @@template_args[render_symbol] = locals_keys.inject({}) { |h, k| h[k] = true; h } - locals_code = locals_keys.inject("") do |code, key| - code << "#{key} = local_assigns[:#{key}] if local_assigns.has_key?(:#{key})\n" + locals_code = "" + unless locals_keys.empty? + locals_code << locals_keys.inject("local_assigns = local_assigns.symbolize_keys\n") do |code, key| + code << "#{key} = local_assigns[:#{key}] if local_assigns.has_key?(:#{key})\n" + end end "def #{render_symbol}(local_assigns)\n#{locals_code}#{body}\nend" |