LoginSignup
2
0

More than 5 years have passed since last update.

Rails5とMySQLで絵文字を使えるようにするリンク集

Posted at

いつも苦労するので...

大まかに...

  • MySQL側の設定(character_set => utf8mb4, collation => utf8mb4_binあたり)を設定
  • Railsのconfig/database.ymlのcharaset, collation, encodingあたりをutf8mb4, utf8mb4_binに設定
  • create_tableするときの設定を、config/initializer/utf8mb4.rbあたりに書いておく
  • (DBに設定を反映させる)

一番参考になる

Rails5.1でutf8mb4(絵文字)に対応させる on @Qiita https://qiita.com/okamu_/items/5eb81688849fbe351350

設定し直すときは、データベースを作り直すのが楽(他の方法もありそう)

rails db:drop
rails db:setup

その他参考になりそう

AWS Aurora MySQL5.7互換の文字コードをutf8mb4に変更 on @Qiita https://qiita.com/shohein/items/ed192526f68ceb1ec60b

RailsとMySQLでiOSの絵文字に対応(UTF8MB4化)した話 - Akata Works http://akataworks.hatenadiary.jp/entry/2016/02/26/102439

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0