# Routing error

**URL:** <https://www.ruby-forum.com/t/routing-error/143482>\
**Category:** Rails\
**Created:** [July 19, 2008, 4:57am UTC](https://www.ruby-forum.com/t/routing-error/143482 "2008-07-19T04:57:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [July 19, 2008, 4:57am UTC](https://www.ruby-forum.com/t/routing-error/143482/1 "2008-07-19T04:57:03Z")

</div>

Hello All,

I’m trying to implement a new method action in my controoller to which  
I ll make an ajax call. So my routes go like this :

map.resources :photos,  
:collection =\> {  
:increment\_downloads =\> :post  
}  
but on my ajax call, I m still getting a 405 error : 405 Method Not  
Allowed

my js ajax call goes like this :

var myAjax = new Ajax.Request(’/photos/increment\_downloads/’,{method:  
‘get’, parameters:params })

Can anyone help with this issue.

Thanks,

Joel

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [July 20, 2008, 1:35am UTC](https://www.ruby-forum.com/t/routing-error/143482/2 "2008-07-20T01:35:31Z")

</div>

You are getting this method not allowed error because in your ajax  
call you are using http method get but in the routes you are using  
post.

Make both of them post or in your routes, change :increment\_downloads  
=\> :post to :increment\_downloads =\> :any

Cheers
