tags:

views:

43

answers:

2

I intended to create a controller that handles a contact page. I created the controller ContactsController. The problem is that it is asking for a table with the same name:

Missing Database Table

Error: Database table username_contacts for model Contact was not found.

Notice: If you want to customize this error message, create app/views/errors/missing_table.ctp

Do I really need to create a table with no data for this?

This is my controller code:

<?php
class ContactsController extends AppController {

    var $name = 'Contacts';


    function index($id = null)
    {
        $this->set('page', ClassRegistry::init('Page')->findByShortname($id));
    }
}
+2  A: 
var $name = 'Contacts';
var $uses = array();

not to be that guy, but this is documented well. http://book.cakephp.org

Adam
no problem Adam. I also thought it would be documented.
Thorpe Obazee
+2  A: 

You might want to create the model anyway as you'll almost certainly find you need to do some database type stuff. It doesn't need to use a db_table:

class ModelWithoutTable extends AppModel
{
    var $useTable = false;
}

Think "fat model - thin controller"

Leo