more rails 4 refactoring for queries