title: Namespaced controllers not working, RoutingError: wrong constant name
body: <p>I'm trying to setup a subdirectory in my Rails 3.2.3 app to service API requests at: <code>http://example.com/api</code></p>
  
  <p>I have created a directory like: <code>app/controllers/api/</code></p>
  
  <p>and I'm following the standard convention for implementing the namespaced controllers:</p>
  
  <pre><code>module Api
    class GroupsController &lt; ApplicationController
      # RESTful verbs implemented here
    end
  end
  </code></pre>
  
  <p>I've setup a namespaced route like this:</p>
  
  <pre><code>namespace :api, defaults: {format: 'json'} do
    resources :groups
  end
  </code></pre>
  
  <p>However requests to <code>http://example.com/api/groups.json</code> result in the following exception:</p>
  
  <pre><code>ActionController::RoutingError (wrong constant name groups):
    app/controllers/api/groups_controller.rb:2:in `&lt;module:Api&gt;'
    app/controllers/api/groups_controller.rb:1:in `&lt;top (required)&gt;'
  </code></pre>
  
  <p>As you can see, it appears that the name "groups" here isn't valid because it's lowercase. I have no idea where this is coming from though.</p>
  
  <p>I have read in a few places that a version of the right-aws gem was breaking the String#camelize method and causing similar errors. However I have confirmed that this gem is not present in my Rails application's stack.</p>
  
  <p>Been slamming my head against this for some time. Has anyone else ever hit this problem?</p>
  
  <p><strong>EDIT:</strong> pasted output from <code>$ rake routes</code>:</p>
  
  <pre><code>root                /                               welcome#index
  api_groups GET      /api/groups(.:format)           api/groups#index {:format=&gt;"json"}
  POST                /api/groups(.:format)           api/groups#create {:format=&gt;"json"}
  new_api_group GET   /api/groups/new(.:format)       api/groups#new {:format=&gt;"json"}
  edit_api_group GET  /api/groups/:id/edit(.:format)  api/groups#edit {:format=&gt;"json"}
  api_group GET       /api/groups/:id(.:format)       api/groups#show {:format=&gt;"json"}
  PUT                 /api/groups/:id(.:format)       api/groups#update {:format=&gt;"json"}
  DELETE              /api/groups/:id(.:format)       api/groups#destroy {:format=&gt;"json"}
  </code></pre>