Permalink
Browse files

Name compiled render methods

  • Loading branch information...
1 parent 198ec03 commit 2c4f8aae5ca8489bb3e47712f50b3f57015811d9 @jeremy jeremy committed Jun 11, 2010
Showing with 11 additions and 8 deletions.
  1. +11 −8 actionpack/lib/action_view/template.rb
@@ -156,11 +156,12 @@ def counter_name
end
def inspect
- if defined?(Rails.root)
- identifier.sub("#{Rails.root}/", '')
- else
- identifier
- end
+ @inspect ||=
+ if defined?(Rails.root)
+ identifier.sub("#{Rails.root}/", '')
+ else
+ identifier
+ end
end
private
@@ -267,9 +268,11 @@ def #{method_name}(local_assigns)
end
def build_method_name(locals)
- # TODO: is locals.keys.hash reliably the same?
- @method_names[locals.keys.hash] ||=
- "_render_template_#{@identifier.hash}_#{__id__}_#{locals.keys.hash}".gsub('-', "_")
+ @method_names[locals.keys.hash] ||= "#{identifier_method_name}__#{@identifier.hash}_#{__id__}_#{locals.keys.hash}".gsub('-', "_")
+ end
+
+ def identifier_method_name
+ @identifier_method_name ||= inspect.gsub(/[^a-z_]/, '_')
end
end
end

0 comments on commit 2c4f8aa

Please sign in to comment.