Results 1 to 3 of 3
Thread: REST, routing, and overriding
Feb 10, 2008, 16:19 #1
REST, routing, and overriding
So I'm moving towards REST for one of my older apps, but there's some legacy stuff that is making things a bit more difficult. For example, this URL:
(Where "posts" is the main thing we're dealing with, "topic" is broad, and "category" belongs_to "topic".) I still want to keep that URL structure even though I have three separate models here: Post, Topic, and Category. So instead of cramming everything into the Post model, I've gone with traditional RESTful means, except in separate models. For example:
# => sends a request to my Topic controller to list all posts with the given topic.
The problem is that /posts is restful:
And I can't simply re-route it like so:
map.connect '/posts/:topic', :controller => 'topics', :action => 'index'
...because, well, Rails just doesn't like it. Even though I have that new route added, it still looks for the RESTful route of posts and gives me an exception.
Any thoughts? I'm on edge Rails.