Focusing on a classic Kohana 2 project and I wish to link two models.

I've got a model known as User using the following ORM associations:

protected $primary_key = 'User_ID';
protected $belongs_to = array('group');
protected $has_many = array('user_address');

I've another Model known as User_Address with ORM associations:

protected $table_name = 'user_address';
protected $belongs_to = array('user');

However I get the next SQL error:

Unknown column 'user_address.user_User_ID' in 'where clause' - SELECT `user_address`.* FROM (`user_address`) WHERE `user_address`.`user_User_ID` = 2 ORDER BY `user_address`.`id` ASC

I can tell in the error that it's attempting to connect to user_address.user_User_ID whereas it ought to be user_address.User_ID. It is possible to method to map the foreign key like Kohana 3?

First got it!

Required to add protected $foreign_key = array('user_address' => 'User_ID'); towards the User_Model