diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-11 16:06:25 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-28 14:46:23 -0700 |
commit | 2c4f8aae5ca8489bb3e47712f50b3f57015811d9 (patch) | |
tree | a8910be283183197c24fcaf3f6e3c8425f62c96b /actionpack/lib/action_view | |
parent | 198ec03f5220f9c8ba363011f70a1c487c10b07e (diff) | |
download | rails-2c4f8aae5ca8489bb3e47712f50b3f57015811d9.tar.gz rails-2c4f8aae5ca8489bb3e47712f50b3f57015811d9.tar.bz2 rails-2c4f8aae5ca8489bb3e47712f50b3f57015811d9.zip |
Name compiled render methods
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index c00557209b..103b625a99 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -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 |