Skip to content

Commit

Permalink
Use the inline template's hash as a method key instead of relying on …
Browse files Browse the repository at this point in the history
…a counter
  • Loading branch information
josh committed Jul 5, 2008
1 parent 5a3bc6f commit f22ae15
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions actionpack/lib/action_view/inline_template.rb
Expand Up @@ -2,25 +2,20 @@ module ActionView #:nodoc:
class InlineTemplate #:nodoc:
include Renderable

# Count the number of inline templates
cattr_accessor :inline_template_count
@@inline_template_count = 0

def initialize(view, source, locals = {}, type = nil)
@view = view

@source = source
@extension = type
@locals = locals || {}

@method_key = @source
@method_key = "inline_#{@source.hash.abs}"
@handler = Template.handler_class_for_extension(@extension).new(@view)
end

private
# FIXME: Modifying this shared variable may not thread safe
def method_name_path_segment
"inline_#{@@inline_template_count += 1}"
@method_key
end
end
end

0 comments on commit f22ae15

Please sign in to comment.