This project is archived and is in readonly mode.

#4226 ✓resolved
omarqureshi

Possible bug with uncountable inflections and namedspace routes?

Reported by omarqureshi | March 19th, 2010 @ 12:00 AM | in 3.0.2

If i have an uncountable inflection (in this case "content"), and i was then to add a namespace with a resource named after that inflection to correspond to a model (of that very same name!), e.g:

e.g.

  routes.rb
  ---------
  namespace :admin do
    resources :content
  end

  content_controller.rb
  ---------------------
  class Admin::ContentController < ApplicationController
    def new
      @content = Content.new
    end
  end

I get the following:

1) Error: test_get_new(Admin::ContentControllerTest):
NoMethodError: undefined method new' for Admin::Content:Module<br/>

/Users/omarqureshi/Sites/Ruby191/content-menage/app/controllers/admin/content_controller.rb:8:in `new'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/base.rb:153:in `process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/rendering.rb:11:in `process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:433:in `_run__77664824__process_action__2035442755__callbacks'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:423:in `_run_process_action_callbacks'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:88:in `run_callbacks'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `block in process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/notifications/instrumenter.rb:18:in `instrument'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/notifications.rb:53:in `instrument'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/instrumentation.rb:28:in `process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/rescue.rb:8:in `process_action'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/base.rb:123:in `process'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:41:in `process'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/testing.rb:12:in `process_with_new_base_test'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/test_case.rb:350:in `process'
/Users/omarqureshi/.rvm/gems/ruby-1.9.1-p378%rails3/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/test_case.rb:288:in `get'
/Users/omarqureshi/Sites/Ruby191/content-menage/test/functional/admin/content_controller_test.rb:6:in `block in <class:ContentControllerTest>'

I definitely do NOT have a module called Admin::Content defined in my app or in any gems that I am using (just haml and pg). Fiddling with the resource - e.g. changing it from resources :content to resources :contents, works - however, that is NOT what I am after here, trying to define singular and plural path names doesn't seem to do anything either.

I believe this bug is different from https://rails.lighthouseapp.com/projects/8994/tickets/3930-uncounta...

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages