Routing error

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

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.



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

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