title: Get parent and children objects in single ajax response
body: <p>This rails app I am working on has the following models:</p>
  
  <p>Albums has_many :tracks</p>
  
  <p>Track belongs_to :album</p>
  
  <p>Part of the app allows me to play an entire album by clicking a link. This fires off an ajax request like so:</p>
  
  <pre><code>  $.ajax({
      url: '/albums/' + _this.parent().data("id") + '.json',
      data: { id : _this.parent().data("id") },
      success: function(json) {
        //more code here
  
      }
    });
  </code></pre>
  
  <p>My controller has this:</p>
  
  <pre><code> def show
    @album = Album.find(params[:id])
    render json: @album
   end
  </code></pre>
  
  <p>This all Works!</p>
  
  <p>My question is, how can I get the album and the tracks that belong to that album in one ajax request?</p>
  
  <p>I tried:</p>
  
  <pre><code> render json: @album.tracks
  </code></pre>
  
  <p>This gives me all the tracks but not the album.</p>
  
  <p>So if there is a way to get both with one request please point me in the right direction.</p>
  
  <p>Thanks.</p>