提交 e14acca8 编写于 作者: N Nicholas Seckar

Fixed dependencies related infinite recursion bug when a controller file does...

Fixed dependencies related infinite recursion bug when a controller file does not contain a controller class. Closes #1760. 

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2218 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 de4cd789
*SVN* *SVN*
* Fixed dependencies related infinite recursion bug when a controller file does not contain a controller class. Closes #1760. [rcolli2@tampabay.rr.com]
* Fixed inflections for status, quiz, move #2056 [deirdre@deirdre.net] * Fixed inflections for status, quiz, move #2056 [deirdre@deirdre.net]
* Added Hash#reverse_merge, Hash#reverse_merge!, and Hash#reverse_update to ease the use of default options * Added Hash#reverse_merge, Hash#reverse_merge!, and Hash#reverse_update to ease the use of default options
......
...@@ -93,10 +93,16 @@ def const_load!(name, file_name = nil) ...@@ -93,10 +93,16 @@ def const_load!(name, file_name = nil)
end end
break break
when File.file?(fs_path) when File.file?(fs_path)
self.root.load_file!(fs_path) loaded_file = self.root.load_file!(fs_path)
# Import the loaded constant from Object provided we are the root node. # Import the loaded constant from Object provided we are the root node.
self.const_set(name, Object.const_get(name)) if self.root? && Object.const_defined?(name) self.const_set(name, Object.const_get(name)) if self.root? && Object.const_defined?(name)
# Throw an error if we load the file but we don't find the Object we expect
if loaded_file and not self.const_defined?(name)
msg = "Already loaded file '#{fs_path}' but '#{name.to_s}' was not set, perhaps you need to rename '#{fs_path}'?"
raise LoadError, msg
end
break break
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册