handy rails function