title: sails.js one-to-one association created as one-way association
body: <p>I noticed I was not getting the same response on a post as I was on a get. Specifically, associations.</p>
  
  <p>Referencing 'Create new record while associating w/ another new record'
  <a href="https://github.com/balderdashy/sails-docs/blob/master/reference/blueprint-api/Create.md" rel="nofollow">https://github.com/balderdashy/sails-docs/blob/master/reference/blueprint-api/Create.md</a></p>
  
  <p>I recreate the scenario from the documentation with <code>sails new testProj</code>, then <code>sails generate api pony</code> and <code>sails generate api pet</code>, then update the models to have a one-to-one association.</p>
  
  <p>Pony</p>
  
  <pre><code>module.exports = {
      attributes: {
          pet: {
              model: 'pet'
          }
      }
  };
  </code></pre>
  
  <p>Pony</p>
  
  <pre><code>module.exports = {
      attributes: {
          pet: {
              model: 'pet'
          }
      }
  };
  </code></pre>
  
  <p>Pet</p>
  
  <pre><code>module.exports = {
      attributes: {
          pony: {
              model: 'pony'
          }
      }
  };
  </code></pre>
  
  <p>Then, <code>sails lift</code> away.</p>
  
  <p><code>POST /pony</code></p>
  
  <p>JSON Req</p>
  
  <pre><code>{
    "name": "Pinkie Pie",
    "hobby": "ice skating",
    "pet": {
      "name": "Gummy",
      "species": "crocodile"
    }
  }
  </code></pre>
  
  <p>JSON Res</p>
  
  <pre><code>{
    "name": "Pinkie Pie",
    "hobby": "ice skating",
    "pet": 1,
    "createdAt": "2014-11-21T19:18:09.161Z",
    "updatedAt": "2014-11-21T19:18:09.161Z",
    "id": 1
  }
  </code></pre>
  
  <p>As you can see, the <code>res</code>ponse did not include the full pet object, just its id. In the documentation, it shows the full object being returned.</p>
  
  <p>The entries and the association were definitely created successfully,</p>
  
  <p><code>GET - /pony/1</code></p>
  
  <pre><code>{
    "pet": {
      "name": "Gummy",
      "species": "crocodile",
      "createdAt": "2014-11-21T19:18:09.157Z",
      "updatedAt": "2014-11-21T19:18:09.157Z",
      "id": 1
    },
    "name": "Pinkie Pie",
    "hobby": "ice skating",
    "createdAt": "2014-11-21T19:18:09.161Z",
    "updatedAt": "2014-11-21T19:18:09.161Z",
    "id": 1
  }
  </code></pre>
  
  <p>Is this an error in documentation, or an error in code? Either way, is there a way we can specify that we want the associations to be returned?</p>
  
  <p>One-to-one associations are just showing up as the linked id, many to many do not show up at all. I was looking into the <code>toObject()</code> function for <code>waterline</code> for another issue when I saw the <code>showJoins</code> option; it looks like it might be related to that.</p>
  
  <p>In addition, this one-to-one association is actually only being created as a one-way association.</p>
  
  <p>After completing the same as above:</p>
  
  <p><code>GET - /pet/1</code></p>
  
  <pre><code>{
    "name": "Gummy",
    "species": "crocodile",
    "createdAt": "2014-12-03T20:50:31.346Z",
    "updatedAt": "2014-12-03T20:50:31.346Z",
    "id": 1
  }
  </code></pre>
  
  <p>Notice that no pony is returned.</p>
  
  <p>Just to make sure...</p>
  
  <p><code>GET - /pony/1/pet</code></p>
  
  <pre><code>{
    "name": "Gummy",
    "species": "crocodile",
    "createdAt": "2014-12-03T20:50:31.346Z",
    "updatedAt": "2014-12-03T20:50:31.346Z",
    "id": 1
  }
  </code></pre>
  
  <p><code>GET - /pet/1/pony</code></p>
  
  <p><code>Res</code></p>
  
  <p><code>Specified record (1) is missing relation 'pony'</code></p>
  
  <p>Pony has a pet, pet has no pony.</p>
  
  <p>Anything I'm doing wrong?</p>