The problem is that something deleted the rows from the spatial_ref_sys table.
In my case, the problem was in my DatabaseCleaner configuration in my spec_helper.rb . It was configured to delete / truncate the table.
Modify the configuration to prevent this behavior. For me it was:
config.before(:suite) do DatabaseCleaner.strategy = :deletion, {:except => %w[spatial_ref_sys]} DatabaseCleaner.clean_with :truncation, {:except => %w[spatial_ref_sys]} end
Now you will need to restore the rows in this table. Use a script called spatial_ref_sys.sql to do this.
I am using Postgres.app, so the command to run the script is:
/Applications/Postgres.app/Contents/MacOS/bin/psql -d database_name -f /Applications/Postgres.app/Contents/MacOS/share/contrib/postgis-2.0/spatial_ref_sys.sql
Your team may be slightly different.
source share