diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-23 06:27:52 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-23 06:27:52 +0000 |
commit | 023c4d68cc298f3a4e66fe5f17ca7e99547768b6 (patch) | |
tree | 0d8fb9364b130b703f62cb21fe7dec7210a4b3dc /actionpack/lib/action_view | |
parent | 7fe3fd23b31b0d4209d4b042f24f26bb0632e08c (diff) | |
download | rails-023c4d68cc298f3a4e66fe5f17ca7e99547768b6.tar.gz rails-023c4d68cc298f3a4e66fe5f17ca7e99547768b6.tar.bz2 rails-023c4d68cc298f3a4e66fe5f17ca7e99547768b6.zip |
Caching template logging goes DEBUG
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1903 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 9f21f3fe3b..304d6bf1ed 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -275,16 +275,19 @@ module ActionView #:nodoc: @@loaded_templates[template_path] = info = File.read(template_path) @@compiled_templates[template_path] = nil end + info end def evaluate_assigns(local_assigns = {}) @assigns.each { |key, value| instance_variable_set("@#{key}", value) } saved_locals = {} + local_assigns.each do |key, value| varstr = "@_#{key}_" saved_locals[varstr] = instance_variable_get(varstr) instance_variable_set(varstr, value) + unless self.respond_to?(key) self.class.class_eval("def #{key}; #{varstr}; end") self.class.class_eval("def #{key}=(v); #{varstr} = v; end") @@ -296,8 +299,8 @@ module ActionView #:nodoc: def compile_template(extension, template, file_name) cache_name = file_name || template + unless @@compiled_templates[cache_name] - t_name, t_arg, t_code = nil case extension when :rhtml t_name = 'run_html_' @@ -308,6 +311,7 @@ module ActionView #:nodoc: t_arg = '(xml)' t_code = template end + if file_name i = file_name.index(@base_path) l = @base_path.length @@ -320,12 +324,14 @@ module ActionView #:nodoc: @@template_count += 1 t_name += @@template_count.to_s end + t_def = "def #{t_name}#{t_arg}; #{t_code}; end" self.class.class_eval(t_def) rescue raise ActionViewError, "ERROR defining #{t_name}: #{t_def}" @@compiled_templates[cache_name] = t_name.intern @@loaded_templates[cache_name] = Time.now if file_name - logger.info "Compiled template #{cache_name}\n ==> #{t_name}" if logger + + logger.debug "Compiled template #{cache_name}\n ==> #{t_name}" if logger end @@compiled_templates[cache_name] end @@ -334,7 +340,7 @@ module ActionView #:nodoc: render_sym = compile_template(:rhtml, template, file_name) saved_locals = evaluate_assigns(local_assigns) result = self.send(render_sym) - saved_locals.each{ |k,v| instance_variable_set(k, v) } + saved_locals.each { |k,v| instance_variable_set(k, v) } result end @@ -343,7 +349,7 @@ module ActionView #:nodoc: render_sym = compile_template(:rxml, template, file_name) saved_locals = evaluate_assigns(local_assigns) result = self.send(render_sym, Builder::XmlMarkup.new(:indent => 2)) - saved_locals.each{ |k,v| instance_variable_set(k, v) } + saved_locals.each { |k,v| instance_variable_set(k, v) } result end |