views:

22

answers:

1

I am attempting to beautify my routes so that they follow the syntax of lists/name-of-list/id as per here: http://gregmoreno.ca/how-to-create-google-friendly-urls-in-rails/ I have defined a new route like so:

map.list_permalink 'lists/:name/:id', :controller => 'lists', :action => 'show'

Everything works fine, but my existing ajax methods now route to the show action in the lists controller. How do I get around this? Should I create a separate controller just for rjs?

Edit: Here's an example of one of my ajax calls:

<%= link_to_remote word, :url => {
      :controller => "lists", 
      :action => "display" } %>
+1  A: 

Probably the route you just added catches routes that are used for ajax calls. I don't know how other routes look like, but probably it should work if you will put this new route below old ones. Other problem can be with name of this route. Here you have list_permalink so when you use list_permalink_path then it would point to show action.

klew
I haven't defined any of my rjs actions as routes, do I need to do that and add them above the list_permalink route?
TenJack
No, you don't. But for sure they have to send data to specific url. Can you paste some code that you use for ajax calls?
klew