Welcome Guest, Not a member yet? Register   Sign In
Can't find model -- and it's there
#1

[eluser]mikeyhell[/eluser]
Just changed servers, everything is working fine w/ the exception of my models. It's unable to load any of them w/ the error:


An Error Was Encountered

Unable to locate the model you have specified: registrationmodel

Before you ask, yes there is a file called registrationmodel.php in my models folder, in fact there are several models in there and none of them will load. My old server ran the application fine, but I had to put this on a live server.

I'm wondering if this isn't an issue with the server. How do you check where the model folder references are being made to?

>> Also, I tried logging(4) and the site wouldn't even come up.
#2

[eluser]mikeyhell[/eluser]
Still no luck. I tried calling the models via $this->load->model('models/registrationmodel') didn't work. I'm still somewhat new to CI and don't feel comfortable(at least on a live server) changing things up. Is it possible to change how CI references the models folder?
#3

[eluser]mikeyhell[/eluser]
As per an earlier post I changed my model name to registration_model and updated the references to it. However, I now receive this error message:

Fatal error: Class 'Registration_model' not found in /var/www/system/libraries/Loader.php on line 177

??
#4

[eluser]Rick Jolly[/eluser]
You've shown the file name, but what about the class name? Should be Registration_model extends Model with a capital "R". Windows isn't case sensitive, but *nix is. Could that be your problem?
#5

[eluser]mikeyhell[/eluser]
Tried both... no luck ... error still reads as home_model(changed the name b/c the controller is home.php) Tried Home_model and updated all references:

controller:
Code:
class Home extends Controller {
    
    
    function Home()
    {
        parent::Controller();
        $this->load->helper(array('url', 'form', 'security'));
        $this->load->model('Home_model');        
    }
}

and model:
Code:
class Home_model extends Model {
  function __construct(){
    parent::Model();
  }
}
#6

[eluser]Armchair Samurai[/eluser]
Are you using PHP4 or 5? I noticed you're calling the contructor using two differing syntaxes. If you're on PHP4, the __contruct() syntax won't work.
#7

[eluser]mikeyhell[/eluser]
I changed so that both are using __construct() and still nothing. I think it's odd that if I comment out the load->model line all of my view etc.. load just fine. I don't see why it would be different for the model.

Michael
#8

[eluser]joao.sobrinho[/eluser]
I'm having the same problem.

I have an application that is working properly in my webserver.
When I try it in another one, it gives the same error the first user described and shows the content of my User_model file.

This file is in the models directory.

Can anyone one help me on this ?
#9

[eluser]WanWizard[/eluser]
If the underlying OS of your webserver is non-Windows, make sure the file is called 'user_model', not 'User_model'.

Non-Windows file systems are case-sensitive, and the loader class converts the model name to lower case before trying to load it. This is true for all CI components (models, controllers, views). For some reason library names deviate from this standard, filenames of libraries must start with a capital letter.
#10

[eluser]joao.sobrinho[/eluser]
both OS are linux.




Theme © iAndrew 2016 - Forum software by © MyBB