title: JSON API Resources relationship attributes
body: <p>I have two models related :</p>
  
  <pre><code>class Item &lt; ActiveRecord::Base
    belongs_to :carousel
  end
  </code></pre>
  
  <p>And </p>
  
  <pre><code>class Carousel &lt; ActiveRecord::Base
    has_many :items
  end
  </code></pre>
  
  <p>I trying to open API to carousels using the JSON API Resources gem, i need to show carousel attributes and some items attributes, something like this:</p>
  
  <pre><code> {
     "data": [
       {
         "id": "1",
         "type": "carousels",
         "links": {
         "self": "http://localhost:3000/api/v1/carousels/1"
       },
       "attributes": {
         "name": "primary",
         "items": [
           {
             "title": "first item",   
             "file-url": "url",
             "index": 0
           },
           {
             "title": "second item",   
             "file-url": "url",
             "index": 1
           }
          ]
         }
       }
     ]
  }
  </code></pre>
  
  <p>My carousel resource:</p>
  
  <pre><code>  module Api
      module V1
        class CarouselResource &lt; JSONAPI::Resource
          immutable
          attributes :name, :items
  
          def self.records(options = {})
            user = options[:context][:current_user]
            user.carousels
          end
         end
       end
     end
  </code></pre>
  
  <p>My result:</p>
  
  <pre><code>  {
      "data": [
        {
           "id": "1",
           "type": "carousels",
           "links": {
             "self": "http://localhost:3000/api/v1/carousels/1"
          },
            "attributes": {
            "name": "primary",
            "items": [
              {
                "id": 3,
                "carousel_id": 1,
                "file": {
                  "url": "url"
                },
                "title": "first item",
                "kind": 0,
                "index": 0,
                "created_at": "2017-02-23T10:31:53.592-03:00",
                "updated_at": "2017-03-01T10:30:52.533-03:00"
              },
              {
                "id": 5,
                "carousel_id": 1,
                "file": {
                  "url": "url"
                 },
                "title": "second item",
                "kind": 0,
                "index": 1,
                "created_at": "2017-03-01T10:30:07.011-03:00",
                "updated_at": "2017-03-01T10:30:07.011-03:00"
               }
            ]
          }
        }
      ]
    }
  </code></pre>