mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use the inline template's hash as a method key instead of relying on a counter
This commit is contained in:
parent
5a3bc6f12f
commit
f22ae15a8e
1 changed files with 2 additions and 7 deletions
|
@ -2,10 +2,6 @@ module ActionView #:nodoc:
|
||||||
class InlineTemplate #:nodoc:
|
class InlineTemplate #:nodoc:
|
||||||
include Renderable
|
include Renderable
|
||||||
|
|
||||||
# Count the number of inline templates
|
|
||||||
cattr_accessor :inline_template_count
|
|
||||||
@@inline_template_count = 0
|
|
||||||
|
|
||||||
def initialize(view, source, locals = {}, type = nil)
|
def initialize(view, source, locals = {}, type = nil)
|
||||||
@view = view
|
@view = view
|
||||||
|
|
||||||
|
@ -13,14 +9,13 @@ module ActionView #:nodoc:
|
||||||
@extension = type
|
@extension = type
|
||||||
@locals = locals || {}
|
@locals = locals || {}
|
||||||
|
|
||||||
@method_key = @source
|
@method_key = "inline_#{@source.hash.abs}"
|
||||||
@handler = Template.handler_class_for_extension(@extension).new(@view)
|
@handler = Template.handler_class_for_extension(@extension).new(@view)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# FIXME: Modifying this shared variable may not thread safe
|
|
||||||
def method_name_path_segment
|
def method_name_path_segment
|
||||||
"inline_#{@@inline_template_count += 1}"
|
@method_key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue