I have a hierarchical database structure where University > College >
Department > Course, and I want to select several Course objects for a
certain University. I am achieving this now with a find() function that
looks like this:
courses = Db::Course.find(:all, :include => {:department => {:school =>
:university}},
:conditions => [“university.title = ?”, ‘Stanford’],
:select => “course.code, course.id, department.code”)
My query works, but the select clause doesn’t have any effect… it
doesn’t show up in the query no matter what it is, and crazy values like
‘SDFASDF asdfASD FASD A’ do not raise a database error.
It is wasteful for me to select all the data from the joins when all I
needed some of them for was to process certain conditions. It is a very
fast database operation no matter what but with large sets of data Ruby
is slow to load the whole response.
am I don’t something wrong, or does activerecord need a fix?
thanks sincerely,
Red Daly