Created
August 22, 2015 05:33
-
-
Save itiut/e2e8c3f73dd6c5303cbc to your computer and use it in GitHub Desktop.
Rails 4.2.3 + MySQL 5.6でutf8mb4を使う
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/database.yml | |
default: &default | |
adapter: mysql2 | |
encoding: utf8mb4 | |
charset: utf8mb4 | |
collation: utf8mb4_general_ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/utf8mb4.rb | |
require 'active_record/connection_adapters/abstract_mysql_adapter' | |
module ActiveRecord | |
module ConnectionAdapters | |
class AbstractMysqlAdapter | |
NATIVE_DATABASE_TYPES[:string][:limit] = 191 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment