# Admin::Controller

**URL:** <https://www.ruby-forum.com/t/admin-controller/70796>\
**Category:** Rails\
**Created:** [October 3, 2006, 1:57am UTC](https://www.ruby-forum.com/t/admin-controller/70796 "2006-10-03T01:57:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [October 3, 2006, 1:57am UTC](https://www.ruby-forum.com/t/admin-controller/70796/1 "2006-10-03T01:57:57Z")

</div>

Thanks to the kind members of this forum, I’ve been able to place my  
scaffolds under an “admin” subdirectory

1.[http://sitename](http://sitename) -

[http://sitename/admin/scaffold\_name](http://sitename/admin/scaffold_name)

Yet, I’m wondering if its possible to do the following:

[http://sitename/admin/](http://sitename/admin/)

---

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [October 3, 2006, 2:00am UTC](https://www.ruby-forum.com/t/admin-controller/70796/2 "2006-10-03T02:00:47Z")

</div>

# 1st post not completed

Thanks to the kind members of this forum, I’ve been able to place my  
scaffolds under an “admin” subdirectory (2.)

1. [http://sitename](http://sitename)

2. [http://sitename/admin/scaffold\_name](http://sitename/admin/scaffold_name)

Yet, I’m wondering if its possible to do the following (3.) and have it  
take me to an admin “homepage”… just an .rhtml page where a user can  
select between the different scaffolds.

1. [http://sitename/admin/](http://sitename/admin/)

When I try now, I get a routing error because no admin\_controller.rb is  
specified in the root controller directory. And, if I add it, I can no  
longer use the (2.) method, because it doesn’t route the scaffolds  
properly.

Any ideas?

Thank You,

---

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [October 3, 2006, 11:46am UTC](https://www.ruby-forum.com/t/admin-controller/70796/3 "2006-10-03T11:46:56Z")

</div>

This may be totaly wrong but I have seen code where you have something  
like

Admin::Controller \< ApplicationController

index  
end

main  
end  
end

In this case the controller acts as a controller for the Admin module so  
the index page will be automatically loaded when you use:

[http://sitename/admin](http://sitename/admin)

and the main page will be shown using this URL

[http://sitename/admin/main](http://sitename/admin/main)

---

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [October 3, 2006, 11:52am UTC](https://www.ruby-forum.com/t/admin-controller/70796/4 "2006-10-03T11:52:12Z")

</div>

RJ wrote:

> This may be totaly wrong but I have seen code where you have something  
> like
> 
> Admin::Controller \< ApplicationController
> 
> index  
> end
> 
> main  
> end  
> end
> 
> In this case the controller acts as a controller for the Admin module so  
> the index page will be automatically loaded when you use:
> 
> [http://sitename/admin](http://sitename/admin)
> 
> and the main page will be shown using this URL
> 
> [http://sitename/admin/main](http://sitename/admin/main)

And I am an idiot as I didn’t read your post correctly and you pointed  
out that this broke (2)…

---

<div class="post-metadata">

**Author:** ![ryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://www.ruby-forum.com/u/ryan)\
**Post date:** [October 3, 2006, 12:59pm UTC](https://www.ruby-forum.com/t/admin-controller/70796/5 "2006-10-03T12:59:03Z")

</div>

On 3 October 2006 04:00, Ryan wrote:

> Any ideas?  
> Make Admin::MainController and user routes to connect ‘/admin/’ to this  
> controller:

map.connect ‘/admin/:controller/:action/:id’  
map.connect ‘/admin’, :controller =\> ‘/admin/main’

Caution, this will work only for one action (in the example - ‘index’).  
But I  
guess this will be sufficient for your case.
