Created
February 27, 2012 16:48
-
-
Save pkqk/1925335 to your computer and use it in GitHub Desktop.
backport https://github.com/rails/rails/issues/4651 to rails 3.2
This file contains 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
if Rails::VERSION::MAJOR > 3 || Rails::VERSION::MINOR > 2 | |
raise "Get rid of line #{__LINE__} in #{__FILE__}" | |
else | |
require 'schema_hotfix' | |
end |
This file contains 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
require 'active_record/connection_adapters/abstract_mysql_adapter' | |
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.class_eval do | |
def add_index_length(option_strings, column_names, options = {}) | |
if options.is_a?(Hash) && length = options[:length] | |
case length | |
when Hash | |
column_names.each {|name| option_strings[name] += "(#{length[name]})" if length.has_key?(name) && length[name].present?} | |
when Fixnum | |
column_names.each {|name| option_strings[name] += "(#{length})"} | |
end | |
end | |
return option_strings | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment