Skip to content

3.1: params_wrapper raises error on anynomous controllers #1089

@dchelimsky

Description

@dchelimsky

Given this code:

controller = Class.new(ApplicationController) do
  # ...
end

I get the following error:

+/Users/david/.rvm/gems/ruby-1.9.2-p180@rspec-dev/gems/activesupport-3.1.0.beta1/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `sub' for nil:NilClass (NoMethodError)
+   from /Users/david/.rvm/gems/ruby-1.9.2-p180@rspec-dev/gems/actionpack-3.1.0.beta1/lib/action_controller/metal/params_wrapper.rb:140:in `_default_wrap_model'

This is caused by model_name = self.name.sub(/Controller$/, '').singularize on

model_name = self.name.sub(/Controller$/, '').singularize

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions