diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-14 19:51:43 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-14 19:51:43 -0500 |
commit | dd41f66af577947ad420fbd2a44184344ad5c983 (patch) | |
tree | 26eaa2f32cb192b0c289979655b4bd333ca34de7 /actionpack/lib/action_view/renderable_partial.rb | |
parent | 8a9934a9d9fc98b56c4566ae2e3fd4d83e505d3e (diff) | |
download | rails-dd41f66af577947ad420fbd2a44184344ad5c983.tar.gz rails-dd41f66af577947ad420fbd2a44184344ad5c983.tar.bz2 rails-dd41f66af577947ad420fbd2a44184344ad5c983.zip |
Include Memoizable in ActionView::Template
Diffstat (limited to 'actionpack/lib/action_view/renderable_partial.rb')
-rw-r--r-- | actionpack/lib/action_view/renderable_partial.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/renderable_partial.rb b/actionpack/lib/action_view/renderable_partial.rb index 7b51eccc27..d2fe635b9c 100644 --- a/actionpack/lib/action_view/renderable_partial.rb +++ b/actionpack/lib/action_view/renderable_partial.rb @@ -3,20 +3,17 @@ module ActionView # NOTE: The template that this mixin is beening include into is frozen # So you can not set or modify any instance variables + include ActiveSupport::Memoizable + def variable_name - @variable_name ||= name.sub(/\A_/, '').to_sym + name.sub(/\A_/, '').to_sym end + memorize :variable_name def counter_name - @counter_name ||= "#{variable_name}_counter".to_sym - end - - def freeze - # Eager load and freeze memoized methods - variable_name.freeze - counter_name.freeze - super + "#{variable_name}_counter".to_sym end + memorize :counter_name def render(view, local_assigns = {}) ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do |