提交 ee82e1c3 编写于 作者: A Andy Lindeman 提交者: David Chelimsky

Add fix for error when an anonymous controller subclasses ApplicationController

上级 14d5e3e4
......@@ -140,6 +140,9 @@ def inherited(klass)
# This method also does namespace lookup. Foo::Bar::UsersController will
# try to find Foo::Bar::User, Foo::User and finally User.
def _default_wrap_model #:nodoc:
# Return nil if the class is unnamed (i.e., anonymous)
return nil if self.name.nil?
model_name = self.name.sub(/Controller$/, '').singularize
begin
......@@ -168,7 +171,7 @@ def _set_wrapper_defaults(options, model=nil)
end
end
unless options[:name]
unless options[:name] || self.name.nil?
model ||= _default_wrap_model
options[:name] = model ? model.to_s.demodulize.underscore :
controller_name.singularize
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册