I have a log table which has a column recording the number of hours
worked on a task. So there’ll be multiple lines for a particular task.
I want to retrieve the total number of hours worked on a task, so that I
can include the information when one views the task details.
I can write a sql query to do this easily enough, like “SELECT
SUM(hours) AS total FROM tasklog WHERE task_id = x”, but what’s the
rails way to do this?