# Custom resource routes

**URL:** <https://www.ruby-forum.com/t/custom-resource-routes/185964>\
**Category:** Rails\
**Created:** [March 29, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/custom-resource-routes/185964 "2010-03-29T19:44:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 29, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/custom-resource-routes/185964/1 "2010-03-29T19:44:09Z")

</div>

Hi all,

this might be a dumb question, but how can you produce custom resource  
routes?

Lets say you want to add extra parameters in your url but you want your  
url to stay pritty?

edit\_resource\_path(:param1 =\> :value1, :param2 =\> :value2) =\> don’t need  
an id in edit.  
new\_resource\_path(:param1 =\> :value1, :param2 =\> :value2)

This might produce something like  
resource/new?param1=value1&params2=value2

But the thing I want is more like resource/value1/value2/new

Is there a way to overwrite the custom resource routes?

thank you in advance

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 29, 2010, 8:13pm UTC](https://www.ruby-forum.com/t/custom-resource-routes/185964/2 "2010-03-29T20:13:24Z")

</div>

I didn’t see anything like that in Rails Guides.  
Of course you can overwrite resource routes but you will lose those  
helpers.  
I think you can either be Restful or not. You can’t go both ways. If  
you are Restful, you obey the rules. That’s the whole point IMHO.  
Other people can understand the structure of your resource without  
knowing the internals of your application. Rails can guess the  
structure and create helpers for you. That’s the bright side.  
And from the Rest point of view value1 and value2 belong exactly in  
the query string IMHO.

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 29, 2010, 10:42pm UTC](https://www.ruby-forum.com/t/custom-resource-routes/185964/3 "2010-03-29T22:42:26Z")

</div>

Art Shayderov wrote:

> I didn’t see anything like that in Rails Guides.  
> Of course you can overwrite resource routes but you will lose those  
> helpers.  
> I think you can either be Restful or not. You can’t go both ways. If  
> you are Restful, you obey the rules. That’s the whole point IMHO.  
> Other people can understand the structure of your resource without  
> knowing the internals of your application. Rails can guess the  
> structure and create helpers for you. That’s the bright side.  
> And from the Rest point of view value1 and value2 belong exactly in  
> the query string IMHO.

Well, I can understand the fact that value1 and value2 should belong in  
the query string. But lets state that those values are necessary to be  
able to use the REST interface, why not putting them along in the url  
then?

It would be nice also in the aspect of pritty urls.

Does anyone else know a workaround?
