I have a table named “roles_users” in my database. As well as a model named “roles_users.php” in my application/model folder:
<?php
class Model_Roles_users extends ORM {
}
I’m trying to create a new row using the following code:
$role = ORM::factory('roles_users');
However I’m getting an error saying “Class ‘Model_Roles_users’ not found”. It’s working with other tables but not this one. Does anybody know why?
You are not supposed to create models for pivot tables, but rather add rows with something like this:
if you really insist on having a model for that table, it will be Model_Roles_User (model/roles/user.php, having only the last word in it’s name singular).