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:
/posts/topic/category
(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:
/posts/topic
# => sends a request to my Topic controller to list all posts with the given topic.
...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.
You can use standard routes and RESTful routes at the same time, however order becomes important. Makes sure the map.connect comes BEFORE the map.resource.
The other thing is to make sure the reg ex is right to - it looks like you want something more like /posts/:topic/:category - it might even help to tell the router that :topic and :category are string.
Yeah, I've hit on all of those aspects; my guess is that map.connect in incompatible if you're trying to override map.resources, regardless of order. It might be one of those setups where conventions don't seem to work. I might have to end up manually describing all of the RESTful routes of the posts controller with the exception of the few that I need to be slightly different.
Bookmarks