Forum: Ruby on Rails Best way to set database connection collation in rails?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Alex (Guest)
on 2013-06-12 22:35
(Received via mailing list)
Hello, I want to change the connection collation that rails uses but I'm
unsure of exactly what the best way to do this is.  Everything in MySQL
the server, database and all tables are set to utf8_unicode_ci
but the connection collation in rails still appears to be
(the default?).  We are using the mysql2 adapter.

I've seen a couple of possible methods:
Set the collation to utf8_unicode_ci via an init-connect line in the
database server's my.cnf
Set the ActiveRecord ConnectionAdapter to use the desired collation.

Is there a best approach?

Alternately, how much does it matter if the connection collation doesn't
match set in the database server?


~ Alex
This topic is locked and can not be replied to.