Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1: params_wrapper raises error on anynomous controllers #1090

Merged
merged 4 commits into from May 17, 2011

Conversation

dchelimsky
Copy link
Contributor

Given this code:

Class.new(ApplicationController)

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
Copy link
Contributor

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

@josevalim
Copy link
Contributor

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

@alindeman
Copy link
Contributor

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 added a commit that referenced this pull request May 17, 2011
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants