# Routes path problem when using link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/routes-path-problem-when-using-link-to-remote/163516>\
**Category:** Rails\
**Created:** [March 21, 2009, 8:40am UTC](https://www.ruby-forum.com/t/routes-path-problem-when-using-link-to-remote/163516 "2009-03-21T08:40:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shardul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@shardul](https://www.ruby-forum.com/u/shardul)\
**Post date:** [March 21, 2009, 8:40am UTC](https://www.ruby-forum.com/t/routes-path-problem-when-using-link-to-remote/163516/1 "2009-03-21T08:40:32Z")

</div>

Hello there,

My routes.rb has following

map.resources “parties” , :controller=\> “political\_parties” ,  
:collection =\> {:states =\> :get , :nationals =\> :get }

In one of my views i was trying to do something like this

\<%= link\_to\_remote “State Parties” , :url=\> states\_parties\_path ,:update  
=\> {:success =\> ‘parties\_list’} %\>

But I was getting following error on log

ActionController::MethodNotAllowed (Only get, put, and delete requests  
are allowed.):

Any idea whay this is?

---

<div class="post-metadata">

**Author:** ![shardul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@shardul](https://www.ruby-forum.com/u/shardul)\
**Post date:** [March 21, 2009, 9:36am UTC](https://www.ruby-forum.com/t/routes-path-problem-when-using-link-to-remote/163516/2 "2009-03-21T09:36:32Z")

</div>

On 21 Mar., 08:40, Shardul M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> =\> {:success =\> ‘parties\_list’} %\>
> 
> But I was getting following error on log
> 
> ActionController::MethodNotAllowed (Only get, put, and delete requests  
> are allowed.):
> 
> Any idea whay this is?

In your routes file you defined that you only wanted GET requests two  
the states action. Currently it doesn’t work since Prototype makes  
POST requests by default. You have two opportunities:

A) Correct your routes file:  
map.resources “parties” , :controller=\>  
“political\_parties” , :collection =\> {:states =\> :post , :nationals  
=\> :get }

B) Correct the link:  
\<%= link\_to\_remote “State Parties” , :url=\>  
states\_parties\_path, :update =\> {:success =\> ‘parties\_list’}, :method  
=\> :get %\>

The ActionController::MethodNotAllowed error in general means that you  
have attempted to call an action that is not allowed to be called with  
that method. E.g. you can’t POST to the show action, it only allows  
GET.

–  
Cheers,  
David K.  
[http://twitter.com/rubyguy](http://twitter.com/rubyguy)
