title: Calculate new average afterSave (or something better?) in CakePHP
body: <p>I'm building a rating system where a user can rate something from 1-5 stars.</p>
  
  <p>I was wondering if there's a way to automatically calculate all of a specific item's ratings (from the ratings table where model='x' and foreign_key='y') on <code>afterSave</code> or something similar.</p>
  
  <p>I can do it in the ratings_controller just fine... just thought it might be more ideal to be done automatically in the model.  Can anyone point me in the right direction for this?</p>
  
  <p>I would LOVE to hear that there's some kind of association setting in CakePHP that allows it to do this for you - something like:</p>
  
  <pre><code>//Rating model
  var $belongsTo = array(
      'Restaurant' =&gt; array(
          'averageValue' =&gt; 'rating
      )
  );
  </code></pre>
  
  <p>But - I'm sure that's asking to much :)</p>