patch.txt

Jesse Barros -, 04/17/2009 09:18 pm

Download (741 Bytes)

 
1
Index: system/libraries/ORM.php
2
===================================================================
3
--- system/libraries/ORM.php	(revision 4208)
4
+++ system/libraries/ORM.php	(working copy)
5
@@ -319,8 +319,9 @@
6
 		elseif (in_array($column, $this->has_many))
7
 		{
8
 			// one<>many relationship
9
-			return $this->related[$column] = ORM::factory(inflector::singular($column))
10
-				->where($this->foreign_key($column, $column), $this->object[$this->primary_key])
11
+			$model = ORM::factory(inflector::singular($column));
12
+			return $this->related[$column] = $model
13
+				->where($this->foreign_key($column, $model->table_name), $this->object[$this->primary_key])
14
 				->find_all();
15
 		}
16
 		elseif (in_array($column, $this->has_and_belongs_to_many))