vendredi 10 juillet 2015

Rails Nesting paths, not resources

I have a "Author" with name as a field, has_many articles. "Article" with name and description as fields, belongs_to author and has_many comments. and a "Comment" with comment_text and article_id as fields, belongs_to article,

I am looking for nesting paths i. e. ,(authors/:id/comments) How do I nest paths, but not resources.

I mean, I don't want to use author_id in "Comment", but when I visit authors/:id/comments, I should be able to see all articles associated with author and comment on them.

Aucun commentaire:

Enregistrer un commentaire