search for: begun_at

Displaying 1 result from an estimated 1 matches for "begun_at".

2006 Jul 16
4
Calculations across multiple tables
I have a time tracking app where (pseudo-code) Client has_many Task has_many TimeRecord TimeRecord start_at, :datetime end_at, :datetime What I''m trying to do (and I have done using find_by_sql in the past) is get a sum of the timespan given by ended_at - begun_at for each client. Is it naive to imagine that AR''s calculations will span relations to provide a grouped result? The SQL I''m feeding to find_by_sql comes out something like this: SELECT client_id, task_id, project_id, clients.client_name, tasks.description, time_records....