Matt Vickers Wed Feb 16 11:32:06 -0500 2011

Subject: Models not found, no directory error

Hey,

I just moved my app from my localhost to a server. Everything is linked up properly, I'm not getting any errors except for:

"Fatal error: Class 'Event' not found in /home/secure/events/index.php on line 7"

If I change the path, to one that doesn't exist, in:

$cfg->set_model_directory(BASE_PATH . '/inc/php/models/');

Then it throws an error saying it's an unknown directory.

Finally, If I include the model directly into my script everything works, but then I'm afraid AR isn't finding the model itself.

Did I miss a step when transferring the site?

Thanks,

Matt


Gabriel Gilder Wed Feb 16 20:52:59 -0500 2011

I'm seeing this too. So far I'm thinking there's some problem with ActiveRecord's autoload function that is preventing it from loading the class files on demand. I'm going to poke around a bit more and see if I can isolate the problem.

Gabriel Gilder Wed Feb 16 21:20:46 -0500 2011

I figured out what's going on here. My dev environment was a Mac OS system with a case-insensitive file system, and my production environment's file system is case-sensitive. So, I had to rename my model files to exactly match the case of the class names. So for instance, for a class named "VideoPost", your model file must be "VideoPost.php", not "videoPost.php" or "videopost.php".

I suppose ActiveRecord could mitigate this issue by doing a looser match against file names in the model directory, but this would probably have some slight performance cost...

Hope that helps for you, Matt!

-Gabriel

(1-2/2)