diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 6075696ab..3025b1d43 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -874,6 +874,7 @@ class Controller extends Object { $object = $this->{$this->modelClass}; } else { $className = null; + $name = $this->uses[0]; if (strpos($this->uses[0], '.') !== false) { list($name, $className) = explode('.', $this->uses[0]); } diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 0f8534c57..9997f88ef 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -84,7 +84,6 @@ class ControllerTest extends CakeTestCase { $Controller->passedArgs[] = '1'; $Controller->params['url'] = array(); $Controller->constructClasses(); - $Controller->modelClass = null; $results = Set::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id'); $this->assertEqual($results, array(1, 2, 3)); @@ -92,6 +91,8 @@ class ControllerTest extends CakeTestCase { $results = Set::extract($Controller->paginate('ControllerComment'), '{n}.ControllerComment.id'); $this->assertEqual($results, array(1, 2, 3, 4, 5, 6)); + $Controller->modelClass = null; + $Controller->uses[0] = 'Plugin.ControllerPost'; $results = Set::extract($Controller->paginate(), '{n}.ControllerPost.id'); $this->assertEqual($results, array(1, 2, 3));