moving scripts to rails