ActiveRecord Model Querying

Hi,
I have two table with the following structure

================
Projects Table

id| Name | Description

==============================
Tasks Table

id|project_id|task_name|complete_dt|effort

table and task are related by a one-to-many association

Is there any way to query Tasks using active record and get effort put
in on each day?

Doing this via SQL is trivial, but for the life of me haven’t been
able to figure out how to do this using the Model

Any ideas ?

What does your SQL look like? I’m a bit confused as to what you mean by
“effort put in on each day”

Are you just trying to get all tasks where complete_dt = a certain date?

Task.group(“complete_dt”).sum(“effort”)

Hey,
That worked. Thanks for the quick reply :slight_smile:

Regards,
Elroy

On May 15, 5:15pm, “[email protected][email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs