So, let's get straight: I'm struggling to days do convert this SQL Statement:
select * from (
select distinct on (program_id) editions.*, programs.*
from editions inner join programs on editions.program_id = programs.id
where programs.station_id = 1) as editionsprograms
order by fixed desc, published_at desc, time desc
limit 4;
to an Arel rails query. Someone has any idea about how could make an Arel query that would have the same effect of the above SQL?