public function actionList() { $models = Commits::model()->findAll(); if (empty($models)) { $this->_sendResponse(404, 'No records found. Try flushing the database?'); } else { $rows = array(); foreach ($models as $model) { $row = $model->attributes; $row['author'] = $model->author; $rows[] = $row; } $this->_sendResponse(200, CJSON::encode($rows)); } }