# Restful routing question

**URL:** <https://www.ruby-forum.com/t/restful-routing-question/170050>\
**Category:** Rails\
**Created:** [June 11, 2009, 6:22pm UTC](https://www.ruby-forum.com/t/restful-routing-question/170050 "2009-06-11T18:22:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [June 11, 2009, 6:22pm UTC](https://www.ruby-forum.com/t/restful-routing-question/170050/1 "2009-06-11T18:22:54Z")

</div>

Hi,

I was wondering if you guys could help me out.

i have a link\_to url like so:  
discard\_contents(current\_project, :to\_project\_id =\> params[:id])

# =\>

[http://localhost:3000/projects/1163131/discard\_contents?to\_project\_id=1121802](http://localhost:3000/projects/1163131/discard_contents?to_project_id=1121802)

but I keep getting this “No action responded to 1163131” error

I am guessing it’s some issue with my routing configuration, but I’m not  
seeing it…

#from routes.rb

map.resources :projects, :member =\> { … :move\_or\_discard\_contents =\>  
:any, :move\_contents =\> :post, :discard\_contents =\> :post }, :collection  
=\> { … } do |project|

end

/projects/discard\_contents/1163131?to\_project\_id=1121802 works.

any ideas?

---

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [June 11, 2009, 6:43pm UTC](https://www.ruby-forum.com/t/restful-routing-question/170050/2 "2009-06-11T18:43:01Z")

</div>

Oops. The rails link\_to path is actually:  
discard\_contents\_project\_path(current\_project, :to\_project\_id =\>  
params[:id])

---

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [June 11, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/restful-routing-question/170050/3 "2009-06-11T19:17:51Z")

</div>

I know this is probably obvious, but you have verified the route  
exists and looks right with “rake routes” and have restarted your  
server recently enough that it has the route, yes?

---

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [June 11, 2009, 9:42pm UTC](https://www.ruby-forum.com/t/restful-routing-question/170050/4 "2009-06-11T21:42:22Z")

</div>

Yep… I have done both. This is the output from my rake routes.

discard\_contents\_project POST /projects/:id/discard\_contents(.:format)  
{:controller=\>“projects”, :action=\>“discard\_contents”}

It seems like it should be a valid route…

I found it: :method =\> :post. The method needed to be explicitly set  
since the route only allows the path if the request method is post.
