Nested resources with RESTful Rails

Hi,

I'm using RESTful in Rails, and I have an application with the following situation:

I have categories, articles and comments. A category can contain many articles (one-to-many relation) and an article can have many comments (one-to-many relation). This is like nested in nested resources. My question is how do I treat this in RESTful?

BTW, I've already implemented the code for categories and articles, I still have to add the comments and I'm not sure how. If I add comments, I'll have to display the comments only inside the article show view and there shouldn't be a view where I can only see some comments. Also, how do I integrate the comments_controller::index action with the articles show view?

Hi, I recommend you to consult this paper by Google - "RESTful Rails Development"    On the second part, it shows a pretty detailed example how nested resource could be handled probably - how to revise route.rb, etc.    Hope this could resolve your puzzle.

Br, Xi

myst_tt, you forgot to post the link. thanks :slight_smile:

http://www.google.com/url?sa=t&ct=res&cd=4&url=http%3A%2F%2Fwww.b-simple.de%2Fdocuments%2Fdownload%2F6&ei=qNUKR4G8Ip7ynAONrfWmBQ&usg=AFQjCNGNi84oAkjqPF42jgMvhyhN0bRibg&sig2=FHJY8wB74qbE3LXj_JnUzw

I've read this and I understand the RESTful concept. Though it's not obvious that I shouldn't make the categories resources.