# Restful named member routs is not decoded correctly

**URL:** <https://www.ruby-forum.com/t/restful-named-member-routs-is-not-decoded-correctly/158826>\
**Category:** Rails\
**Created:** [January 28, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/restful-named-member-routs-is-not-decoded-correctly/158826 "2009-01-28T15:45:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 28, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/restful-named-member-routs-is-not-decoded-correctly/158826/1 "2009-01-28T15:45:41Z")

</div>

I define my own member action in the root file as  
map.resources :helps  
map.resources :helps, :member =\> {:display =\> :put}

The tables listed by rake routs displays the pathes and helpers as  
display\_help PUT /helps/:id/display  
{:controller=\>“helps”, :action=\>“display”}  
formatted\_display\_help PUT /helps/:id/display.:format  
{:controller=\>“helps”, :action=\>“display”}

I am using it in a link in the view as display\_help\_path  
(:id=\>‘What\_is\_Disweb’)  
and the url in the corresponding link is  
[http://localhost:3000/hepls/What\_is\_Disweb/display](http://localhost:3000/hepls/What_is_Disweb/display)

This seems all OK, but rails tell me that it cannot find an action  
named What\_is\_Disweb, when I click on the link  
I seems as the url is decoded as I had not add the member action

Anyone that has any ideas of what is going on ? Has anyone met the  
same problem ?  
What mistakes have I done ? What are the sources of my problem ?  
I am displaying the link in another window ? Is that the source of the  
problem?  
I have tried to find the source of the probllem for hours, but without  
any success.

Any help is very much appreciated

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [January 28, 2009, 5:37pm UTC](https://www.ruby-forum.com/t/restful-named-member-routs-is-not-decoded-correctly/158826/2 "2009-01-28T17:37:26Z")

</div>

On Jan 28, 2009, at 9:45 AM, Hans wrote:

> I define my own member action in the root file as  
> map.resources :helps

You don’t need the first one, the second (with the :member option)  
does what you need.

> (:id=\>‘What\_is\_Disweb’)  
> and the url in the corresponding link is  
> [http://localhost:3000/hepls/What\_is\_Disweb/display](http://localhost:3000/hepls/What_is_Disweb/display)

You’ve stipulated that the method used for the display action must be  
PUT, so if you click on a link, that’s a GET and it is most likely  
matching the default route:  
map.connect ‘/:controller/:action/:id’

> problem?  
> I have tried to find the source of the probllem for hours, but without  
> any success.
> 
> Any help is very much appreciated

Try having just:

map.resources :helps, :member =\> {:display =\> :get}

and see if your problem goes away.

I’d also recommend commenting out the default routes and add the  
actual routing that you need.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
