Scopes and ambiuous columns

How do you deal with ambiguous columns when using scopes.

Scopes seem to work brilliant until I need to join / joinWith another table and then the problems with ambiguous columns occurs.

How do I get around this, because if I cannot get round this, it basically nullifies the effectiveness of scopes altogether.

How do you deal with it?

Kind of found a method of getting tableName …




$obj = new $this->modelClass;

echo $obj->tableName();



Ok now it works with relations but not for queries with no relations.

How do you guys handle scopes / relations?