To fix this in Rails, I’ve found that you can simply add the following line to each section (development/production etc.) of your database.yml
file:
template: template0
See ActiveRecord/ConnectionAdapters/PostgreSQL/SchemaStatements#create_database for other options.