I have the following default scope defined in one of my models
default_scope order("IF(format = #{FORMATS[:wide]}, 1, 0) DESC, created_at DESC, name ASC")
It worked fine on my dev machine where I'm running MySQL, but borked when deployed to production where we use postgres. Is there a way to write that using Arel instead of straight SQL? FORMATS[:wide]
returns an integer, but it may not be in any particular order. I just want records with that particular format
to be returned first.