Link to home
Start Free TrialLog in
Avatar of syedasimmeesaq
syedasimmeesaqFlag for United States of America

asked on

why this simple cakephp app not working

I am trying out cakephp and I have database configured. I have three tables in database,
posts
users
comments

In models folder I have 2 files, post.php and user.php
post.php has this
<?php
class Post extends AppModel {

            var $name='Post';
            var $blenogsTo = array('User');
}
?>

user.php has this
<?php

class User extends AppModel {

      var $name = 'User';
      var $hasMany = array('Post');
      
}
?>

then under controllers folder I have 2 files, posts_controller.php and users_controller.php
in posts_controller.php I have this
<?php

class PostsController extends AppController {
                  var $name = 'Posts';
                  var $scoffold;
}
?>

in users_controller.php I have this
<?php

class UsersController extends AppController {
                  var $name = 'Users';
                  
                  var $scoffold;
                  
}
?>



Now all I am doing is scoffolding and when I go to localhost/cake/users
it gives me this error

Missing Method in UsersController
Error: The action index is not defined in controller UsersController

Error: Create UsersController::index() in file: app\controllers\users_controller.php.

<?php
class UsersController extends AppController {

      var $name = 'Users';


      function index() {

      }

}
?>
Notice: If you want to customize this error message, create app\views\errors\missing_action.ctp.


any help will be appreciated.
Thanks
Avatar of RefeshToNetworking
RefeshToNetworking

You need to be using the User model.

Make sure this is in your controller: $uses = array('User');
Avatar of syedasimmeesaq

ASKER

which file?
what do u mean $uses?
thanks
ASKER CERTIFIED SOLUTION
Avatar of syedasimmeesaq
syedasimmeesaq
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial