title: rails namespace uninitialized constant
body: <p>I'm making admin panel in my app, I made the scaffold user controller for admin (User Model already exists) like this:</p>
  
  <pre><code>rails g scaffold_controller Admin::User username:string password_digest:string role:string
  </code></pre>
  
  <p>and in routes</p>
  
  <pre><code>namespace :admin do
  resources :users
  resources :dashboard
  end
  </code></pre>
  
  <p>and controllers/admin/users_controllers.erb looks like </p>
  
  <pre><code>class Admin::UsersController &lt; ApplicationController
    # GET /admin/users
    # GET /admin/users.json
    def index
      @admin_users = Admin::User.all
  
      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @admin_users }
      end
    end
  </code></pre>
  
  <p>so when i go to url /admin/users i got the following error:</p>
  
  <pre><code>NameError in Admin::UsersController#index
  
  uninitialized constant Admin::User
  </code></pre>
  
  <p>How do i solve this problem</p>
  
  <p>Thanks</p>