我有这个查询:
case_timeline = Case.select('cases.*, case_steps.*, tasks.*, task_statuses.*')
.joins(case_steps: { tasks: :task_status} )
.where('cases.id = ?', case_1.id)
.where('task_statuses.task_status_name in (?)', ['Open', 'Overdue', 'Completed'])
.order('tasks.end_date DESC')
completed_timeline =
case_timeline
.select{|task| task.task_status_name == "Completed" }
我怎样才能按日期订购?我试过这个:
completed_timeline =
case_timeline
.select{|task| task.task_status_name == "Completed" }
.order('end_date')
但它给出了错误:
undefined method `order' for #<Array:0x000000051da2e0>