title: Uninitialized Constant Error in Nested Controller
body: <p>I am getting this error:</p>
  
  <pre><code>Routing Error
  uninitialized constant RegistrationsController
  </code></pre>
  
  <p>This is my log:</p>
  
  <pre><code>Started GET "/registrants/1/registrations/new" for 127.0.0.1 at 2012-07-03 00:55:44 -0500
  
  ActionController::RoutingError (uninitialized constant RegistrationsController):
  
  Rendered /.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (8.5ms)
  </code></pre>
  
  <p>This is the part of my routes.rb that is appropriate:</p>
  
  <pre><code>registrant_registrations GET    /registrants/:registrant_id/registrations(.:format)          {:action=&gt;"index", :controller=&gt;"registrations"}
                                     POST   /registrants/:registrant_id/registrations(.:format)          {:action=&gt;"create", :controller=&gt;"registrations"}
         new_registrant_registration GET    /registrants/:registrant_id/registrations/new(.:format)      {:action=&gt;"new", :controller=&gt;"registrations"}
        edit_registrant_registration GET    /registrants/:registrant_id/registrations/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"registrations"}
             registrant_registration GET    /registrants/:registrant_id/registrations/:id(.:format)      {:action=&gt;"show", :controller=&gt;"registrations"}
                                     PUT    /registrants/:registrant_id/registrations/:id(.:format)      {:action=&gt;"update", :controller=&gt;"registrations"}
  </code></pre>
  
  <p>This is my Registrations Controller, which is at <code>/app/controllers/portal/registrations_controller.rb</code>:</p>
  
  <pre><code>class Portal::RegistrationsController &lt; ApplicationController
    def create
          @registrant = current_member.registrants.find(params[:registrant])
          @registration = @registrant.registrations.build
  
          respond_to do |format|
            if @registration.save
              format.html {   redirect_to root_path, :notice =&gt; "Registration successfully created!" }
              format.json { head :ok }
            else
             format.html { redirect_to root_path, :notice =&gt; "There was a problem with the registration." }
            end
          end     
    end
  
  end
  </code></pre>
  
  <p>I get this error when I call <code>new_registrant_registration_path(registrant)</code> from a view in <code>Portal#index</code>.</p>
  
  <p>Edit:</p>
  
  <p>For completeness, here is my routes.rb file in its entirety before the solution was found. Radar mentioned the gist I posted, but I figured I would put the code here in case that gist is deleted.</p>
  
  <pre><code>MyApp::Application.routes.draw do
  
    match 'admin' =&gt; 'admin/dashboard#index', :as =&gt; :admin_root
    match 'portal' =&gt; 'portal#index', :as =&gt; :member_root
  
    namespace 'admin' do
      match 'profile' =&gt; 'profile#show', :as =&gt; :profile
  
      resources :members
      resources :admins
          resources :packages
          resources :products
          resources :levels
          resources :lessons
          resources :registrations
          resources :registrants, :controller =&gt; 'customers/registrants'
          resources :locations
          resources :schools
          resources :terms
          resources :customers
          resources :invoices
          resources :payments
    end
  
    namespace 'member' do
      resources :registrations
    end
  
    match 'register' =&gt; 'member/registrations#new', :as =&gt; :signup  
    match 'login' =&gt; 'member_sessions#new', :as =&gt; :login
    match 'logout' =&gt; 'member_sessions#destroy', :as =&gt; :logout  
    match 'admin/login' =&gt; 'admin_sessions#new', :as =&gt; :admin_login
    match 'admin/logout' =&gt; 'admin_sessions#destroy', :as =&gt; :admin_logout
  
    match 'member/activate/:activation_code' =&gt; 'member/activations#create', :as =&gt; :member_activation
    match 'member/:id/activate/resend' =&gt; 'member/activations#resend', :as =&gt; :resend_member_activation
    match 'member/:id/activate' =&gt; 'member/activations#new', :as =&gt; :new_member_activation
  
    match 'member/password/reset/begin' =&gt; 'member/password_resets#new', :as =&gt; :new_member_password_reset, :via =&gt; :get
    match 'member/password/reset' =&gt; 'member/password_resets#create', :as =&gt; :member_password_resets, :via =&gt; :post
    match 'member/password/:token/finish' =&gt; 'member/password_resets#edit', :as =&gt; :edit_member_password_reset, :via =&gt; :get
    match 'member/password/reset' =&gt; 'member/password_resets#update', :as =&gt; :member_password_reset, :via =&gt; :put
  
    match 'admin/packages/new/:partial' =&gt; 'admin/packages#new'
  
    resources :admins
  
    resources :registrants, :controller =&gt; 'portal/registrants' do
      resources :registrations
    end
  
    resource :admin_session
    resource :member_session
  
    root :to =&gt; 'portal#index'
  
  end
  </code></pre>