Permalink
Browse files

Refs #147. Adding more verbose baked validations for models.

  • Loading branch information...
1 parent 32683d3 commit 47fc47ff59526560b3bae975d1f64a75066a66a2 @predominant predominant committed Jan 1, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 cake/console/templates/default/classes/model.ctp
@@ -42,7 +42,14 @@ if (!empty($validate)):
foreach ($validate as $field => $validations):
echo "\t\t'$field' => array(\n";
foreach ($validations as $key => $validator):
- echo "\t\t\t'$key' => array('rule' => array('$validator')),\n";
+ echo "\t\t\t'$key' => array(\n";
+ echo "\t\t\t\t'rule' => array('$validator'),\n";
+ echo "\t\t\t\t//'message' => 'Your custom message here',\n";
+ echo "\t\t\t\t//'allowEmpty' => false,\n";
+ echo "\t\t\t\t//'required' => false,\n";
+ echo "\t\t\t\t//'last' => false, // Stop validation after this rule\n";
+ echo "\t\t\t\t//'on' => 'create', // Limit validation to 'create' or 'update' operations\n";
+ echo "\t\t\t),\n";
endforeach;
echo "\t\t),\n";
endforeach;

0 comments on commit 47fc47f

Please sign in to comment.