Welcome Guest, Not a member yet? Register   Sign In
Model Automatically Inherited into Controller
#1

[eluser]Unknown[/eluser]
First post on the forums, I have just started getting my head around Codeigniter and I am very impressed.

Am i missing something though? In Rails, the model is automatically inherited into the controller if it is named the same, I have tried with Codeigniter and it doesn't seem to work.

For example, I have application/controllers/product.php and application/models/product.php and the methods aren't automatically loaded into the controller.

I have had to change the filename of the model to application/models/product_model.php and added the following the __construct in the product controller.

Code:
$this->load->model('product_model','product',TRUE);

Is this the right way to do it?




Theme © iAndrew 2016 - Forum software by © MyBB