From 68189f14613907a6cac0823ad4d0fdfbd439e6de Mon Sep 17 00:00:00 2001 From: Pierre-Luc Brunet Date: Fri, 22 Apr 2011 13:27:01 -0400 Subject: [PATCH] GH-68 relationship references wrong table (by jmoberley) --- lib/Relationship.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Relationship.php b/lib/Relationship.php index 082e65dbd..0a8fa5b95 100644 --- a/lib/Relationship.php +++ b/lib/Relationship.php @@ -498,7 +498,7 @@ public function load(Model $model) { if ($this->through) { // verify through is a belongs_to or has_many for access of keys - if (!($through_relationship = $this->get_table()->get_relationship($this->through))) + if (!($through_relationship = $model->table()->get_relationship($this->through))) throw new HasManyThroughAssociationException("Could not find the association $this->through in model " . get_class($model)); if (!($through_relationship instanceof HasMany) && !($through_relationship instanceof BelongsTo))