Skip to content
Browse files

Add fix for error when an anonymous controller subclasses Application…

…Controller
  • Loading branch information...
1 parent 14d5e3e commit ee82e1c3015392c87c88ee32003763210a75d1ec @alindeman alindeman committed with May 16, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 actionpack/lib/action_controller/metal/params_wrapper.rb
View
5 actionpack/lib/action_controller/metal/params_wrapper.rb
@@ -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

0 comments on commit ee82e1c

Please sign in to comment.
Something went wrong with that request. Please try again.