# Map.resource and map.connect

**URL:** <https://www.ruby-forum.com/t/map-resource-and-map-connect/89443>\
**Category:** Rails\
**Created:** [March 20, 2007, 2:55pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443 "2007-03-20T14:55:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kapslok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/46a35a/32.png) [@kapslok](https://www.ruby-forum.com/u/kapslok)\
**Post date:** [March 20, 2007, 2:55pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443/1 "2007-03-20T14:55:08Z")

</div>

I’m very new to Rails (1.2) and I’m trying to work something out:

I have an AdminController which provides a basic index action and view.  
I also have a bunch of resources eg. Profiles, etc. these resources  
utilize the RESTful resource controllers created using the  
“script/generate scaffold\_resource…” generator.

Currently I have the following mapping:  
map.resource :profiles, :path\_prefix =\> “/admin”

I’d like to be able to map the resources so they are accessible from  
/admin only, however, I’m finding I can access the profiles controller  
from both /profiles and /admin/profiles. I’d like to be able only access  
the profile controller from admin, and then be able to allow/deny access  
to actions based on member authentication/authorisation.

I’ve read all the posts/articles on nested resources, folder/controller  
hacks etc (the latter I can’t get to work either), and I don’t seem to  
be getting anywhere.

Can anyone throw some light please?

Cheers and thanks in advance.

---

<div class="post-metadata">

**Author:** ![kapslok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/46a35a/32.png) [@kapslok](https://www.ruby-forum.com/u/kapslok)\
**Post date:** [March 20, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443/2 "2007-03-20T15:27:55Z")

</div>

Rick O. wrote:

> On 3/20/07, Dominique J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Can anyone throw some light please?
> > 
> > Cheers and thanks in advance.
> 
> Do you have the standard map.connect ‘:controller/:action/:id’ route  
> in there still?
> 
> –  
> Rick O.  
> [http://lighthouseapp.com](http://lighthouseapp.com)  
> [http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
> [http://mephistoblog.com](http://mephistoblog.com)

Hi Rick, and thanks for the reply. I check out your Lighthouse app the  
other day and was quite jealous. I was in the process of creating  
somethign similar as a value add to another web app. It’s very nice.

Um, yes I do still have the standard map.connect at the very bottom on  
the routes file.

---

<div class="post-metadata">

**Author:** ![kapslok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/46a35a/32.png) [@kapslok](https://www.ruby-forum.com/u/kapslok)\
**Post date:** [March 20, 2007, 3:21pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443/3 "2007-03-20T15:21:53Z")

</div>

On 3/20/07, Dominique J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can anyone throw some light please?
> 
> Cheers and thanks in advance.

Do you have the standard map.connect ‘:controller/:action/:id’ route  
in there still?

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![kapslok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/46a35a/32.png) [@kapslok](https://www.ruby-forum.com/u/kapslok)\
**Post date:** [March 20, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443/4 "2007-03-20T15:37:20Z")

</div>

> Hi Rick, and thanks for the reply. I check out your Lighthouse app the  
> other day and was quite jealous. I was in the process of creating  
> somethign similar as a value add to another web app. It’s very nice.

Thanks.

> Um, yes I do still have the standard map.connect at the very bottom on  
> the routes file.

That’s why you can still access it as /profiles. I typically remove  
this route, as any controllers typically have named routes created for  
them.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![kapslok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/46a35a/32.png) [@kapslok](https://www.ruby-forum.com/u/kapslok)\
**Post date:** [March 20, 2007, 3:40pm UTC](https://www.ruby-forum.com/t/map-resource-and-map-connect/89443/5 "2007-03-20T15:40:37Z")

</div>

Rick O. wrote:

> That’s why you can still access it as /profiles. I typically remove  
> this route, as any controllers typically have named routes created for  
> them.

Thanks heaps I’m so grateful because I been mucking around with this for  
far too long now. Cheers.
