Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:42:17+00:00 2026-06-09T07:42:17+00:00

I have an admin namespace as such: namespace :admin do resources :users resources :base

  • 0

I have an admin namespace as such:

  namespace :admin do
    resources :users
    resources :base
  end

With the following directory structure:

/app/controllers/
        + admin
            - base_controller.rb
            - users_controller.rb
        - users_controller.rb
        - application_controller.rb

I have to wrap admin/users_conroller.rb in a module Admin end, otherwise I get an Uninitialized constant BaseController error:

class Admin::BaseController < ApplicationController
end

# Works fine
module Admin
  class UsersController < BaseController
  end
end

# Breaks with error
class Admin::UsersController < BaseController
end

Any idea why this is happening? Using Rails 3.2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:42:18+00:00Added an answer on June 9, 2026 at 7:42 am

    Namespaces map to directories, underscored filenames are camelcased for class names.

    class Some::DeeplyNested::BaseActionsController < ApplicationController
    

    needs to be in app/controllers/some/deeply_nested/base_actions_controller.rb for rails to find it.

    In your code, there is no app/controllers/base_controller.rb, so BaseController in

    class Admin::UsersController < BaseController
    

    points to no class Rails knows about. You need to give it the admin namespace (as your class definition for BaseController also has)

    class Admin::UsersController < Admin::BaseController
    end
    

    The above and your working code from your Question are one in the same

    module Admin
      class UsersController < BaseController
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller like follows: namespace :admin do resources :posts end # app/controllers/admin_posts_controller.rb
I have routes structure: namespace :admin do resources :currencies end rake routes output: admin_currencies
In my Rails 3 project I have: namespace :admin do resources :users end scope
I have an app that has the following in the routes file: namespace admin
I have this setup in my routes: namespace :admin do resources :posts end so
I have the following routes: namespace :admin do scope 'foo', module: 'foo' do resources
In my routes.rb I have this: map.namespace :admin do |admin| admin.resources :galleries do |galleries|
in my Rails app have this routes.rb: devise_for :admin namespace :admin do root :to
I have the following routes in my app: GET /admin/comments(.:format) {:controller=>admin/comments, :action=>index} admin_comments POST
I'm working on an app in CodeIgniter, and I want to have admin pages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.