2011-09-15 32 views
0

我正在使用ruby博客示例。所以我有表格帖子,評論和標籤。帖子表與許多評論和標籤相關。這很好。 - 我沒有得到的一點是如何獲得一個單一的JSON響應在他的依賴記錄(標籤和評論)的職位? - URL格式如何獲得第一篇文章的所有評論?Ruby:幾個依賴表的JSON結果

非常感謝, 凡妮莎

回答

0

你將加入職位表上POST_ID comments表。類似這樣的:

Select comments from comments, posts where posts.post_id = <id of post you want comments of> and posts.id = comments.post_id