ruby code on survey