Turkish character support in Rails with Postgresql

I’m trying to setup Turkish language support for a Rails project on Postgresql

First of all, following settings added into config/database.yml to support Turkish language:

development:
  ...
  collation: tr_TR.UTF-8
  ctype: tr_TR.UTF-8
  template: template0

After that, tr_TR.UTF-8 locale generated with sudo dpkg-reconfigure locales command.

But I’m getting following error on rake db:create:

PG::WrongObjectType: ERROR:  invalid locale name: "tr_TR.UTF-8"

How can I correct invalid locale name errors?

It seems that you did everything correctly but if Postgresql started before the tr_TR.UTF-8 locale generation, you just need to restart:

$ sudo service postgresql restart

It should work after that.

Thanks for your quick reply, restarting postgresql resolve the problem.