Skip to content

Commit

Permalink
I changed the validation to work properly with plugin models
Browse files Browse the repository at this point in the history
  • Loading branch information
gersh committed Nov 29, 2010
1 parent 4c70ddf commit 9f99dac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion views/helpers/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function bind($modelNames, $options=array()) {
//filter the rules to those that can be handled with JavaScript
foreach($modelNames as $modelName) {
$model = classRegistry::init($modelName);
$arr=explode('.',$modelName);
$realModelName=$arr[0];

foreach ($model->validate as $field => $validators) {
if (array_intersect(array('rule', 'allowEmpty', 'on', 'message', 'last'), array_keys($validators))) {
Expand Down Expand Up @@ -97,7 +99,7 @@ function bind($modelNames, $options=array()) {
$temp['negate'] = true;
}

$validation[$modelName . Inflector::camelize($field)][] = $temp;
$validation[$realModelName . Inflector::camelize($field)][] = $temp;
}
}
}
Expand Down

0 comments on commit 9f99dac

Please sign in to comment.