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 8183639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:13:27+00:00 2026-06-07T01:13:27+00:00

I’m building an admin control panel (attempting to ;) ). I have been looking

  • 0

I’m building an admin control panel (attempting to 😉 ).

I have been looking at Backend administration in Ruby on Rails and as suggested I am trying to make Admin::AdminController that checks for admin and sets the layout etc.

But I’m also trying to set a route in it that routes /admin to /admin/dash

From my understanding of reading http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing , specifically section 2.6,

Admin::AdminController

tells rails that Admin is the name space, AdminController is the controller which is a subclass (extension?, implementation of the interface?) of ApplicationController. Which would imply the controller should live in app/controllers/admin/ and be called admin_controller.rb.

But what I want is

AdminController

I get errors like:

uninitialized constant Admin::Controller

My code for the route:

  match :admin, :to => 'admin/admin#dash'
  namespace :admin do
    # Directs to /admin/resources/*
    match '/dash', to: '#dash'
    resources :users, :pictures
  end

I have put the controller in app/controllers/admin, app/controllers and the combinations with

class Admin::AdminController < ApplicationController
  before_filter :admin_user
  # / ** STATIC ADMIN PAGES ** /
  def dash
  end
end

or class AdminController < ApplicationController.

Edit: Maybe it’s my understanding of routing.
Example:

namespace :admin do
  get "/dash"

vs.

namespace :admin do
  match "/dash" to "admin#dash"

vs.

namespace...
  match "/dash" to "#dash"

The first one makes it so i can display a dash via the controller, i.e. admin/dash would be controlled by

AdminController < ApplicationControler
  def dash
  end

Does the second one route admin/admin/dash to admin/dash?

TL/DR:
I think my confusion comes from syntax or my poor understanding of RESTful practices or maybe even class / object inheritance in ruby.

Thanks for helping this n00b out. 🙂

Side question: can I change my code to be minimized until someone opens it like a spoiler so it doesn’t crowd things up if I find more information and add it?

  • 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-07T01:13:30+00:00Added an answer on June 7, 2026 at 1:13 am

    I think your initial approach was correct, but you need to change it a little.

    1) insert the /admin => /admin/dash inside the namespace (imho, its better to redirect it)

    match 'admin' => redirect('admin/dash')
    

    or

    namespace :admin do
      match '/', to: 'admin#dash'
    end
    

    2) You can’t match ‘/dash’ to ‘#dash’ since you’re not inside a resource block, you’re inside a namespace block, so it doesnt’ have implied controller.

    namespace :admin do
      match 'dash', to: 'admin#dash'
      # This will go to Admin::AdminController#dash
      # (first Admin because of the namespace,
      #  and the second because of the controller name)
    end
    

    hope it works 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

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.