I'm working on ruby on rails and trying to creata an Api for my application.
Basically is a blog and i want show in the json response of view.json.jbuild not only the thread information but also all the comments related to the thread in the way that id = threadpost_id
I have this file view.json.jbuilder with this code:
json.extract! @threadpost, :id, :title, :text, :created_at, :updated_at
And this file comment.json.jbuilder:
json.extract! @comment, :id, :text, :created_at, :updated_at, :threadpost_id
How can i join them to show the threadpost and all the related comments?