title: Chaining waterline calls with Promises
body: <p>I have been hitting my head off a wall on this for the last 3 days.</p>
  
  <p>I am using sailsjs &amp; the waterline ORM that comes bundled. I want to run DB calls one after an other. I know I can do this by nesting inside "then" calls but it just looks wrong.</p>
  
  <p>I have gone over the Q documentation and tutorials several times but I still don't get how to connect and fire "then" calls from existing Promises sequentially :(</p>
  
  <p>I want to:</p>
  
  <ol>
  <li>create a user</li>
  <li>create a action</li>
  <li>link the user &amp; action</li>
  <li>update the user</li>
  <li>update the action</li>
  </ol>
  
  <p>My code looks like</p>
  
  <pre><code> var mail = 'test@test.com';
  
   Users.create({email:mail, name:''}).then(console.log).fail(console.log);
  
   Actions.create({actionID:123})
   .then(function(error, action){
          Users.findOneByEmail(mail).then(function(person){
              person.actions.add(action.id);
              person.save(console.log);
          }).fail(console.log)  
       });
  
   Users.update({email:mail},{name:'Brian'}).exec(console.log);
   Actions.update({actionID:123},{now:'running'}).exec(console.log);
  </code></pre>
  
  <p>As you can see from the code I've been using a mix of exec &amp; then :P</p>
  
  <p>I think the way is to connect the 
  Users.create(...).then ->  Action.create(...).then -> Users.findOneByEmail(...).then -> *and the updates.</p>
  
  <p><strong>Huge thanks</strong> from any help</p>