Error Handling Question

Right now I have in my layout


if (Yii::app->user->hasErrors()) {

     echo Yii::app->user->getFlash('error');

}

Instead of in all of my controllers calling s


etFlash->('error', CHtml::errorSummary($model));

after each model reference, I’d like to extend the ActiveRecord class to setFlash if there are errors. Anybody have any tips for the BEST way to go about this?

Thanks