Actually, you may run into problems with this: var $validate = array( array( 'rule' => array('validateUnique', 'email') ), );
function validateUnique($fieldValue, $fieldName) { if (!$this->isUnique($fieldName)) { return false; } else { return true; } } When you have multiple models linked that have the same field names with validation rules (e.g. two models with 'name', both of which have validation rules), using this method doesn't properly prefix the field names and you may get an SQL error about ambiguous column names in certain circumstances. Here's what I ended up using: var $validate = array( 'name' => array( 'minlength' => array('rule' => array('minLength', 2)), 'unique' => array('rule' => array('isUnique')), 'required' => array('rule' => array('custom', '/.*/'), 'required' => true, 'on' => 'create'), 'nonEmpty' => array('rule' => array('custom', '/.*/'), 'allowEmpty' => false) ) ); Thanks to Grant Cox for that. Chrs, Dav On 12 May 2008, at 20:49, gmwebs wrote: > > I have posted what I have in my User model (running 1.2.x.x) at > http://bin.cakephp.org/view/646962640 > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---