module ActiveRecord::ConnectionAdapters

Public Instance Methods

native_database_types_with_enum() click to toggle source
# File lib/connection_adapters/mysql2.rb, line 8
def native_database_types_with_enum
  native_database_types_without_enum.merge({
    :enum => { :name => "enum" },
    :set => { :name => "set" }
  })
end
quoted_comma_list(list) click to toggle source
# File lib/connection_adapters/mysql2.rb, line 49
def quoted_comma_list list
  list.to_a.map{|n| "'#{n}'"}.join(",")
end
type_to_sql_with_enum(type, limit: nil, **args) click to toggle source
# File lib/connection_adapters/mysql2.rb, line 20
def type_to_sql_with_enum(type, limit: nil, **args)
  if type.to_s == "enum" || type.to_s == "set"
    list = limit
    if limit.is_a?(Hash)
      list = limit[:limit]
    end
    "#{type}(#{quoted_comma_list(list)})"
  else
    type_to_sql_without_enum(type, limit: limit, **args)
  end
end