query a database with ruby methods