Skip to content

Commit

Permalink
Fallback to camel_case for related model lookup if underlined version…
Browse files Browse the repository at this point in the history
… not found
  • Loading branch information
duellsy committed Feb 27, 2014
1 parent 9e308cd commit 7aa1868
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Venturecraft/Revisionable/Revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ private function getValue($which = 'new')

// Now we can find out the namespace of of related model
if (! method_exists($main_model, $related_model)) {
throw new \Exception('Relation ' . $related_model . ' does not exist for ' . $main_model);
$related_model = camel_case($related_model); // for cases like published_status_id
if (! method_exists($main_model, $related_model)) {
throw new \Exception('Relation ' . $related_model . ' does not exist for ' . $main_model);
}
}
$related_class = $main_model->$related_model()->getRelated();

Expand Down

0 comments on commit 7aa1868

Please sign in to comment.