diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index b4c2556ce..4173c1dd2 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -757,7 +757,7 @@ class Controller extends Object { } foreach($modelObj->hasAndBelongsToMany as $associationName => $assocData) { - $otherModelKey = Inflector::underscore($associationName); + $otherModelKey = Inflector::underscore($assocData['className']); $otherModelObj = &ClassRegistry::getObject($otherModelKey); if ($doCreateOptions) { $fieldNames[$otherModelKey]['model'] = $associationName;