Fix error when using postgres.
Update tests for postgres fix.
Merge pull request #247 from t-bullock/postgres-fix-rails4

Fix errors when using Postgres.