function index() {
//obtiene todos los ingredientes y los pasa a la vista:
$usuarios = $this->Usuario->find('all'); // wrong Model name
$this->set('usuarios', $usuarios);
}
On Apr 27, 7:44 pm, Pablo <pespinos...@gmail.com> wrote:
> I just installed cakephp and made my first model, controller and view.
> It seems that the controller can't find its model. Since it's a
> spanish name Usuarios, I tried different inflections and didnt work
> out.
>
> This is the code. It can't be simpler!
>
> ----------------- UsuariosController.php
>
> class UsuariosController extends AppController {
>
> function index() {
> //obtiene todos los ingredientes y los pasa a la vista:
> $usuarios = $this->Usuarios->find('all');
> $this->set('usuarios', $usuarios);
> }
>
> }
>
> --------------------- Usuario.php
> class Usuario extends AppModel {
>
> }
>
> And the result is the following...
>
> Notice (8): Undefined property: UsuariosController::$Usuarios [APP/
> controllers/usuarios_controller.php, line 7]
>
> Code
>
> function index() {
> //obtiene todos los ingredientes y los pasa a la vista:
> $usuarios = $this->Usuarios->find('all');
>
> UsuariosController::index() - APP/controllers/usuarios_controller.php,
> line 7
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
> [main] - APP/webroot/index.php, line 88
>
> Fatal error: Call to a member function find() on a non-object in /var/
> www/pacex/app/controllers/usuarios_controller.php
>
> Somebody help me , please!!!
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment