used active record querying to order pins