Model Automatically Inherited into Controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Model Automatically Inherited into Controller (/showthread.php?tid=45979) |
Model Automatically Inherited into Controller - El Forum - 10-13-2011 [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? |