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

2012ef615d01121a0f035df9bf5707b2?d=identicon&s=25 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
collation,
but the connection collation in rails still appears to be
utf8_general_ci
(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?

Thanks,

~ Alex
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.