Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

3.1: params_wrapper raises error on anynomous controllers #1090

merged 4 commits into from May 17, 2011


None yet
3 participants

dchelimsky commented May 16, 2011

Given this code:


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

I've added a failing test case, and will offer up a solution in the next day or so.


alindeman commented May 16, 2011

What's the expected behavior here? Should param wrapping simply be ignored?


josevalim commented May 16, 2011

@alindeman we should just not try to wrap things automatically then. you would have to be explicit.


alindeman commented May 17, 2011

Awesome @dchelimsky, would love to get this merged for beta2. Adding a comment because GitHub doesn't notify pull request participants simply when new commits are added.

@josevalim josevalim added a commit that referenced this pull request May 17, 2011

@josevalim josevalim Merge pull request #1090 from dchelimsky/issue-1089
3.1: params_wrapper raises error on anynomous controllers

@josevalim josevalim merged commit f1e1e76 into rails:master May 17, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment