jeudi 25 février 2016

how to order by in rails with priority conditional in attributes

example i have a list of users

id           name         role

1            join         member
2            cathy        sale
3            mark         admin
4            orthor       member
5            Sy           admin

i want to order by role asc with priority when role= 'member'

result:

 id           name         role

1            join         member
4            orthor       member
3            mark         admin
5            Sy           admin
2            cathy        sale

how to order by this in rails??

Aucun commentaire:

Enregistrer un commentaire