Learning to query and populate a database via Ruby