I have a database where all tables are prefixed by "bs" . I baked a model from bs_states table and it's generate the following code.
<?php
App::uses('AppModel', 'Model');
/**
* State Model
*
* @property country $Country
* @property Seller $Seller
*/
class State extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = '_states';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'state_id';
/**
* Display field
*
* @var string
*/
public $displayField = 'state_iso';
//The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'Country' => array(
'className' => 'country',
'foreignKey' => 'country_iso',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
/**
* hasMany associations
*
* @var array
*/
public $hasMany = array(
'Seller' => array(
'className' => 'Seller',
'foreignKey' => 'state_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}
This code is working fine in local system but when I upload it to the prodution server it showing following message.
Missing Database Table Error: Table bsstates for model State was not found in datasource default.
Initially I thought it's a cache issue so I've done the following:
- I have cleared the tmp/cache directory
- I changed the debug mode
Configure::write('debug', 0);toConfigure::write('debug', 2);
But no luck. I am still facing the same problem. My database connection on production server is good because other model are working fine.
bsandstates:public $useTable = '_states';- Andy