CodeIgniter Forums

Full Version: Unable to locate model file..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]nikefido[/eluser]
I have searched this but didn't get a good answer (or at least I seem to be doing it correctly).

The error: "Unable to locate the model you have specified: editinfo_model" - Why is it all lowercase? (it's not supposed to be)

I did a search where editInfo_model is seen and it all shows up as the correct "editInfo_model".


More info:
file name (within the models folder): editInfo_model.php
Code:
class EditInfo_model extends Model {
    
    function EditInfo_model() {
        parent::Model();
        $this->load->database();
    }
file being called:
Code:
$this->load->model('editInfo_model');

I have migrated from a Windows to a Linux server. Apparently there is capitalization problem, but i've searched and not come up with a different use of capitalization.

w.t.f. mate?

El Forum

[eluser]nikefido[/eluser]
I made a new controller as a test, this is ALL that's on it:

Code:
<?php
class MyControl extends Controller {

    function MyControl() {
        parent::Controller();
        $this->load->model('editInfo_model');
    }

}

?>
and I still get the error.

El Forum

[eluser]nikefido[/eluser]
I fixed it, but all i did was make the model "editinfo" rather than "editInfo"

...sigh.

whatever

El Forum

[eluser]Glen Swinfield[/eluser]
If you look, in Loader.php you will see this:

$model = strtolower($model);

// then looks for model file.

Model 'files' are are all searched for in lower case - Linux is case sensitive, Windows is not. So make sure your filename is lowercase.

Also the manual says:

"Where Model_name is the name of your class. Class names must have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class.

The file name will be a lower case version of your class name."

That's your problem.

El Forum

[eluser]nikefido[/eluser]
Ah, ic - I read that but I only caught the "first letter capitalized" in the class name.

Thanks for the clarification!

El Forum

[eluser]skrobma[/eluser]
I had the same problem, I migrated my code to UNIX from windows (WAMP) and I received the same error. My model name began with a capital letter, changed the case and everything works great. This thread saved me much frustration. :-)

Thanks, great forum!!!