提交 9488b127 编写于 作者: J Justin Collins

Change "caller" of rendered templates to an array

instead of a single caller
上级 927af46a
......@@ -72,7 +72,7 @@ module Brakeman
#Each template which is rendered is stored separately
#with a new name.
if called_from
name = (name.to_s + "." + called_from.to_s).to_sym
name = ("#{name}.#{called_from}").to_sym
end
@tracker.templates[name][:src] = result
......
......@@ -168,7 +168,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
#Process template and add the current class and method name as called_from info
def process_template name, args
super name, args, "#@current_class##@current_method"
super name, args, ["#@current_class##@current_method"]
end
#Turns a method name into a template name
......
......@@ -17,12 +17,16 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
#Process template
def process_template name, args
if @called_from and @called_from.match(/Template:#{name}$/)
Brakeman.debug "Skipping circular render from #{@template[:name]} to #{name}"
return
end
if @called_from
unless @called_from.grep(/Template:#{name}$/).empty?
Brakeman.debug "Skipping circular render from #{@template[:name]} to #{name}"
return
end
super name, args, "Template:#{@template[:name]}"
super name, args, @called_from + ["Template:#{@template[:name]}"]
else
super name, args, ["Template:#{@template[:name]}"]
end
end
#Determine template name
......
......@@ -66,7 +66,7 @@ class Brakeman::Warning
def view_name
return @view_name if @view_name
if called_from
@view_name = "#{template[:name]} (#{called_from})"
@view_name = "#{template[:name]} (#{called_from.last})"
else
@view_name = template[:name]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册