Fixed deprecation warning
Fixed PostgreSQL casting for Rails 4.0+