提交 7c8b43ed 编写于 作者: E Emilio Tagua

Ask if the instance variable is defined before asking for it, avoid *many* warnings.

上级 9027721b
......@@ -991,7 +991,11 @@ def to_content_tag(tag_name, options = {})
end
def object
@object || @template_object.instance_variable_get("@#{@object_name}")
if @object
@object
elsif @template_object.instance_variable_defined?("@#{@object_name}")
@template_object.instance_variable_get("@#{@object_name}")
end
rescue NameError
# As @object_name may contain the nested syntax (item[subobject]) we
# need to fallback to nil.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册