I have 2 models Prize and Staff, One staff HAS_MANY prizes
I want to export noy only the prize, but also embedded the prize's owner (staff) in the JSON response.
How to do it ?
render json: Oj.dump( Prize.where(:staff_id => nil) )
Sample output (But not including the staff information)
{
can_accept_prize_now: true,
name: "Apple MacBook Pro Retina",
sn: 3,
}
Expected output
{
can_accept_prize_now: true,
name: "Apple MacBook Pro Retina",
sn: 3,
staff_id: 80,
staff_name: "Eric"
}