Writing out simple functions on rails