How do I build a query in Ruby on Rails that joins on the max of a has_many relation only and includes a select filter on that relation?

前端 未结 7 1797
走了就别回头了
走了就别回头了 2021-01-06 12:56

I\'m struggling how to have Ruby on Rails do this query right... in short: to join on a has_many relation but only via the most recent record in that r

7条回答
  •  执笔经年
    2021-01-06 13:29

    In my opinion you can get those max dates first to sure not getting old records and then just filter for the required status. Here was the example of doing first part of it

    https://stackoverflow.com/a/18222124/10057981

提交回复
热议问题