Rails Postgres String To Integer Leetcode Solution