Do you want to return if res.nil? Shouldn't you be failing :?