开发者

Using ajax actions with google friendly route

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" } %>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜