I am trying to render json for a child model that belongs_to two parent
models. The models represent a college course offering. Given a course,
I want to show what sections (instances of a course) are offered, and
during what terms (ie semester)
I want to render the single course’s details along with all sections. As
render :json => @course.to_json(:include => :sections)
However, I would also like to include the term data above sections as a
means to group the sections.
Course is aware of Term only through Section
How can I go about doing this in the controller or the model? Can I
accomplish this through to_json or must I override to_json? Perhaps my
model associations need to be adjusted?
Thanks in advance!