skip to Main Content

Postgresql – Rails where method with any created_at

I've got a method like this: def transfers(material, capacity, category, created_at) transfers_range = Transfer.first.created_at..Transfer.last.created_at if created_at.nil? Transfer.where( sender_dispensary_id: id, status: %i[dispatched released returned], capacity: capacity, material: material, created_at: created_at.nil? ? transfers_range : Time.given_month_range(created_at) ).or( Transfer.where( receiver_dispensary_id: id, status: %i[dispatched released…

VIEW QUESTION
Back To Top
Search