Interesting Things
You may need to specify a template in your rails database.yml to use the rails connection to create a Postgres database via your rake scripts that has your preferred configuration.
Specifically, a team found they needed to specify a template (template: template0) in their database.yml to create UTF8 encoded databases for their project running on Ubuntu 11.04.
Note that your milage may vary here, since the settings on the template database will vary by platform, config and compilation. You might not get the same results using template0, but its interested that you can set it since it wasn’t obvious that it was even available.