Rails Postgres String Operations In Javascript