title: Returning only the first child in a child node
body: <p>I have a story model and a post model.  Each story has many posts.  </p>
  
  <p>In my story#index action I would like to use rabl to return all @stories, and each story in @stories should also include a child node containing attributes from its most recently created post.</p>
  
  <p>Here is the closest that I've come to achieving what I'm looking for:</p>
  
  <pre><code>#show.json.rabl
  
  object @story
  
  attributes  :id, :title, :username
  
  child @story.posts.first =&gt; :latest_post do
    attributes  :id, :story_id, :contents, :username
  end
  </code></pre>
  
  <p>This works fine in the stories#show action.  But when I try to extend it with the stories#index action</p>
  
  <pre><code>#index.json.rabl
  
  collection @stories
  
  extends "stories/show"
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ActionView::Template::Error (undefined method `posts' for nil:NilClass):
      1: collection @stories
      2: 
      3: extends "stories/show"
    app/views/stories/show.json.rabl:8:in `render'
  </code></pre>
  
  <p>I believe that I get this error because I'm not setting the @story instance variable used by the show.json.rabl view.  But I'm not sure how to get around this and pass the show.json.rabl the correct story object.</p>
  
  <p>Any help would be greatly appreciated!</p>