title: Routing Error: uninitialized constant
body: <p>I'm trying to set up routes for a mobile API, which should have a versioned api-path. I already could make the mobile Auth work, which is implemented in a separate Controller <em>AuthController</em> located in <strong>/controllers/api/v1/mobile/</strong>. </p>
  
  <p>Usage example:</p>
  
  <pre><code>myapp.com/api/v1/mobile/auth
  </code></pre>
  
  <p>But now I want to register my existing ressources-Controllers to this path-pattern as additional api-routes. Concrete: this would be the <em>TasksController</em> located at <strong>/controllers/tracker/tasks_controller.rb</strong>. So I added a <em>mobile route</em> to the routes-definition:</p>
  
  <pre><code># routes.rb
  namespace :tracker, path: 'timetracking' do
    resources :tasks, 'jobs'
  end
  
  namespace :api do
    namespace :v1 do
      namespace :mobile do
        resources :auth, :only =&gt; [:create, :destroy]
  
        namespace :tracker do    #added mobile route
          resource :tasks, controller: 'tracker/tasks', as: :mobile_tasks
        end
      end
    end
  end
  </code></pre>
  
  <p>But when I call <strong>myapp.com/api/v1/mobile/tracker/tasks</strong> it results in an error-message:</p>
  
  <pre><code>Routing Error
  uninitialized constant Api::V1::Mobile::Tracker
  </code></pre>
  
  <p>I especially added the alias <strong>:mobile_tasks</strong> to this route, to avoid any conflicts with the original tasks-route above. Any ideas, how to set the controller properly for this route?</p>
  
  <p><strong>Update#1</strong></p>
  
  <p>Defining this route as a scope instead of a namespace, didn't work aswell. </p>
  
  <pre><code>scope "/api/v1/mobile/tracker" do
      resources :tasks, controller: 'tracker/tasks', as: :mobile_tasks
  end
  </code></pre>
  
  <p>But this time, it didn't even resolve the route-path itself.</p>
  
  <pre><code>Routing Error
  No route matches [GET] "/api/v1/mobile/tracker/tasks"
  </code></pre>
  
  <p>I assume it might be a problem, that my additional mobile-api route tries to point to a completely different namespace <em>tracker</em>.</p>