I’m having some issues where, when working with a 3rd party’s application’s database I have to do some weird joins where I am often joining to a sort of catch-all table for multiple different kinds of objects.
As such I create has_many or has_one associations that have conditions clauses.
Problem is if I try to join two of these associations in the same query I get an “ambiguous column name”, and rightly so since the same column is called in the condition for both associations.
Is there a way around this issue. Would be nice if I could tell the association to always prefix with the join name.
In the conditions clause, you can assert your table name is present like this:
EDITED
Maybe this is what you are tooking for.