I'm just studying CakePHP so sorry for any obvious mistakes. I have created model class and changed default table name.
class Weathers extends AppModel {
public $tablePrefix = 'weather_';
public $useTable = 'forecasts';
function saveCountries($countries){
...
}
}
And my controller function
if (!$this->loadModel('Weather'))
exit;
$Weather = $this->Weather;
$Weather->saveCountries($countries);
I'm getting error on $Weather->saveCountries($countries);
Error: Table weathers for model Weather was not found in datasource default.
Please help find out what I do wrong.
debug(get_class($Weather));it will most likely beAppModeland notWeathersas you have it now. - tigrangAppModel- VahanWeatherand the file name toWeather.php. What happens is if cake can't find your model, it creates one based off of AppModel - tigrang