fix for issue #1669
Created by: erroric
fix for issue #1669
- fix projects sort order
- fix Postgresql Arel issue (details - https://github.com/gitlabhq/gitlabhq/issues/1669#issuecomment-10449471)
- improve query performance (subqueries vs joins)
Created by: erroric
fix for issue #1669