I've got a workaround Rick. My query actually gets more complex,
that's just the important bits. It's still a bug
I'd prefer to describe it as an unintended implementation specific feature.
What's the solution to this though? Can it be repaired without
breaking backwards compatibility for people who rely on find_by_sql
and STI? If you're using find_by_sql there are a few areas where you
have to be careful, I'm tempted to say that this is one of them...
Koz,
Can't this be detected from the calling class? If the calling class
isn't STI, it shouldn't worry about the type column (which is in the
other table anyway). I'll PDI it.
Can't this be detected from the calling class? If the calling class
isn't STI, it shouldn't worry about the type column (which is in the
other table anyway). I'll PDI it.
This isn't an issue with type really. AR will clobber your id column
too. I think this is an issue with the db adapters not returning
table names with the column name.
I've made a inheritance rework some weeks ago that would possible fix
it since it only loads the inheritance support in the class that'll use
it.
In STI case, it would load only if the class that descends directly
from AR has been inherited and the column specified in the
inheritance_column is available.
People here told me to wait until next release so we can dig into this,
but if you've interesting in testing it out send me a message and i'll
send you the patch.
Can I get some feedback on ticket 5838? I've got a patch and testcase
that works. Rick seems to be opposed to the patch because I'm not
solving all the join issues, but I'd argue that you should at the very
least get the sort of object your asked for back.
Account.find_by_sql() should -never- return something other than
Account objects.