I have a table called car_parts, and my controller is called CarPartsController, file is car_parts_controller.php. Then I have the model Car_Part, file name car_part.php. Here is the code
<?php
class CarPartsController extends AppController {
var $name = 'Car_Parts';
var $uses = array("Car_Part");
function get_part($id)
{
$this->set('car_parts',$this->Car_Part->find('first', array('conditions' => array('Car_Part.car_id' == $id))));
$this->layout = 'master_layout';
}
}
?>
MODEL
<?php
class Car_Part extends AppModel{
var $name = 'Car_Part';
}
?>
View, this view is called get_part.ctp
<?php
print_r($car_parts);
?>
The problem I am having is that it says that it can not find the table car__parts (and it looks like if it had a double underscore but my table does not have a double underscore. Any ideas what I am doing wrong. I am new to Cake PHP.
Drop the underscore between Car & Part: