I have a complex graph of ActiveRecord entities that I want to load with
one big honkin’ join query to avoid ripple loading. It’s for a report.
However :include doesn’t get me all the way there because I want to load
parents of parents (or children of children). I don’t mind doing the
SQL by hand but I’m not quite sure what to do to get the result set into
my model objects. I don’t want to bypass my model objects because they
have important calculation methods I need.
I’d like to run a raw SQL query and then somehow plug the results into
model objects. Sooo, what’s the best way to go about this?