Name compiled render methods

This commit is contained in:
Jeremy Kemper 2010-06-11 16:06:25 -07:00
parent 198ec03f52
commit 2c4f8aae5c
1 changed files with 11 additions and 8 deletions

View File

@ -156,11 +156,12 @@ module ActionView
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 @@ module ActionView
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