buithehoa
5/7/2015 - 3:38 AM

refined_for_emoji.rb

#!ruby
  # config/initializers/mysql_utf8mb4_fix.rb
  require 'active_record/connection_adapters/abstract_mysql_adapter'

  module ActiveRecord
    module EmojiConnectionAdapters
      refine AbstractMysqlAdapter do
        NATIVE_DATABASE_TYPES[:string] = { name: "varchar", limit: 191 }
      end
    end
    
    module ConnectionAdapters
      using EmojiConnectionAdapters
    end
  end