Routes and RJS

Hi Folks,

Sorry to ask more questions :slight_smile:

So I gave a RJS a go, I have a simple countries 'index' which lists countries and with alink to 'show' which shows detail.

It works fine when you go to

/countries/AD in a browser

However the same request via Ajax and RJS (I am checking the http headers) which is a POST I get the error

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

So what do I need to do to get my routing working with RJS?

Thanks Again!

Hi Pete,

Hi Folks,

Sorry to ask more questions :slight_smile:

So I gave a RJS a go, I have a simple countries 'index' which lists countries and with alink to 'show' which shows detail.

Assuming you're using link_to_remote, you can change the HTTP verb using the :method option. See the docs (api.rubyonrails.org) for examples.

HTH, Bill