HowTo inject :project_id into changeset query result

Added by Carl Nygard almost 16 years ago

If I have the following query:

 events += Changeset.find(:all, 
                          :include => :repository, 
                          :conditions => ["#{Repository.table_name}.project_id = ? AND #{Changeset.table_name}.committed_on BETWEEN ? AND ?", 
                                 , date_from, date_to])

How can I inject the project_id from the Repository table into the matched Changeset objects? I'm trying to group_by() a collection of events based on project_id, and everything except the Changeset info has project_id in it.

I saw somewhere that it was possible, but I'm not sure how to do it. Help??