# Resource routes with further options

**URL:** <https://www.ruby-forum.com/t/resource-routes-with-further-options/169022>\
**Category:** Rails\
**Created:** [May 28, 2009, 2:06pm UTC](https://www.ruby-forum.com/t/resource-routes-with-further-options/169022 "2009-05-28T14:06:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [May 28, 2009, 2:06pm UTC](https://www.ruby-forum.com/t/resource-routes-with-further-options/169022/1 "2009-05-28T14:06:58Z")

</div>

Hi you all,  
I have a resource routed in routes.rb, such as  
map.resources :queries

Every Query object has a string with words, and I want to operate on  
each of these words ( each word will generate another object of type  
Queryterm).

The thing is that I have the URL, let’s say /queries/123, and I want to  
call the function (dunno if I’ll use the “edit” function or some other)  
which operates on each of its words in this way:  
/queries/123/[function]/:[position],  
where “function” is the “edit” function or some other I may add with the  
resource option :member, and :position is the position of the next word  
I want to operate with (given the string with words of the query 123).

Question is, Can i have something like  
map.resources :queries :member=\> {:myfunction=\>‘get’}  
but, adding the fact that I am going to pass it a :position  
parameter???

If not, I can use map.connect as usual (or put the :position integer in  
the session), but I would like to know if there is any resource-styled  
way to do it.

Lots of thanks.

---

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [May 28, 2009, 6:29pm UTC](https://www.ruby-forum.com/t/resource-routes-with-further-options/169022/2 "2009-05-28T18:29:47Z")

</div>

map.resources :queries, :member =\> {:myfunction =\> :get}

should do just fine, additional parameters don’t affect the routing

In my app I have:

map.resources :cdocs, :member =\> {:linkable =\> :get}

for one resource, and the linkable invocations take additional  
parameters. Remember parameters come after the ? and don’t affect the  
routing.

---

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [May 29, 2009, 12:49pm UTC](https://www.ruby-forum.com/t/resource-routes-with-further-options/169022/3 "2009-05-29T12:49:56Z")

</div>

Ok, I meant having a url such as  
/myfunction/myparam,  
not  
/myfunction?param=myparam

just for the “?” mark, which is not “cool”, but in a second thought, I’m  
afraid is more Restful than the first one.  
Thanks!

Ar Chron wrote:

> map.resources :queries, :member =\> {:myfunction =\> :get}
> 
> should do just fine, additional parameters don’t affect the routing
> 
> In my app I have:
> 
> map.resources :cdocs, :member =\> {:linkable =\> :get}
> 
> for one resource, and the linkable invocations take additional  
> parameters. Remember parameters come after the ? and don’t affect the  
> routing.
