Property "user.nuserid" Is Not Defined.

I get the error "Property "User.nUserId" is not defined." when I try to access information via a model relation. Strange thing is that this works fine on our development server. We just copied the code to our production server and I started getting this error. The following code causes the error when trying to reference the StudentR relation.


$cWith->UserR->StudentR->strFirstName

If you notice the error refers to "nUserId", with a lower case "d". Nowhere in my database or code do I reference the lower case "d".

Here are the User and Student relations from their models:


'StudentR' => array(self::HAS_ONE, 'Student', 'nUserID'),


'UserR' => array(self::BELONGS_TO, 'User', 'nUserID'),

Why is Yii trying to access the incorrect field "nUserId" rather than "nUserID"?

I figured out the problem For some reason mySQL created the foreign key relation from tblStudents back to tblUsers with a "REFERENCES tblUsers (nUserId)". Not sure why. Deleted the relation and recreated it.