Rails4 「incompatible character encodings: ASCII-8BIT and UTF-8」エラーが出た

自前でSQLを書いていたら、「incompatible character encodings: ASCII-8BIT and UTF-8」というエラーが出た。

ASCII-8BITとUTF-8が文字列中で混在してしまったようだ。
対策としては、下記のようにエンコーディング指定すればよい。

msg.force_encoding("utf-8")

参考:
Rails 4: incompatible character encodings: UTF-8 and ASCII-8BIT - Stack Overflow