# Routing URL REST or not REST

**URL:** <https://www.ruby-forum.com/t/routing-url-rest-or-not-rest/171520>\
**Category:** Rails\
**Created:** [July 4, 2009, 12:13am UTC](https://www.ruby-forum.com/t/routing-url-rest-or-not-rest/171520 "2009-07-04T00:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [July 4, 2009, 12:13am UTC](https://www.ruby-forum.com/t/routing-url-rest-or-not-rest/171520/1 "2009-07-04T00:13:44Z")

</div>

my question is maybe silly… but it’s already July 4th … and I am  
tired…

until now I have been using in my tests the following routes  
(simplified version)

map.resources :academies do |academies|  
academies.resources :ecourses  
academies.resources :instructors  
academies.resources :trainees  
end

so I get the URL type : /academies/1/libraries from  
academy\_libraries\_path(current\_user.academy)

the current\_user being defined , and he is always logged into one  
academy when working ( current\_user.academy)

I wonder is it possible to replace academy\_id in the URL with a  
string ‘CURRENT’ ? and have :

/academies/CURRENT/libraries (then nobody could hack the academy)

or is it better to keep the REST URL type and perform a security check  
(permit ) in the controller ??

thanks

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [July 5, 2009, 12:14am UTC](https://www.ruby-forum.com/t/routing-url-rest-or-not-rest/171520/2 "2009-07-05T00:14:49Z")

</div>

You may also want to look at the :shallow option to map.resources - it  
does pretty much what you’re looking for.

–Matt J.
