class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
Protected Instance Methods
initialize_type_map(m = type_map)
Also aliased as: initialize_without_enum
Alias for: initialize_type_map_with_enum
initialize_type_map_with_enum(m = type_map)
click to toggle source
# File lib/native_enum/activerecord_enum_post42.rb, line 6 def initialize_type_map_with_enum(m = type_map) initialize_without_enum(m) register_enum_type(m, %r(^enum)i) register_set_type(m, %r(^set)i) end
Also aliased as: initialize_type_map
register_enum_type(mapping, key)
click to toggle source
# File lib/native_enum/activerecord_enum_post42.rb, line 15 def register_enum_type(mapping, key) mapping.register_type(key) do |sql_type| if sql_type =~ /(?:enum)\(([^)]+)\)/i limit = $1.scan( /'([^']*)'/ ).flatten Type::Enum.new(limit: limit) end end end
register_set_type(mapping, key)
click to toggle source
# File lib/native_enum/activerecord_enum_post42.rb, line 24 def register_set_type(mapping, key) mapping.register_type(key) do |sql_type| if sql_type =~ /(?:set)\(([^)]+)\)/i limit = $1.scan( /'([^']*)'/ ).flatten Type::Set.new(limit: limit) end end end