Defect #15983

Project.activities returns different types depending on context

Added by Massimo Rossello about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Code cleanup/refactoring
Target version:2.5.0
Resolution:Fixed Affected version:

Description

Project.active_activities, Project.all_activities and, ultimately, Project.activities return:
  • a database relation if the activities on the project are untouched (through TimeEntryActivity.shared.active)
  • an Array if some activities are overridden (through Project.system_activities_and_project_overrides).

This makes any calling code unable to make further operations on the results, and leads to errors that are hard to understand.

Associated revisions

Revision 12854
Added by Jean-Philippe Lang about 4 years ago

Project.activities should always return a ActiveRecord::Relation (#15983).

History

#1 Updated by Jean-Philippe Lang about 4 years ago

  • Category changed from Time tracking to Code cleanup/refactoring
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.5.0
  • Resolution set to Fixed

Fixed in r12854, it now always returns a ActiveRecord::Relation.

Also available in: Atom PDF