Module: ActiveRecord::ConnectionAdapters::MysqlAdapter::Fields

Defined in:
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb

Defined Under Namespace

Classes: Boolean, Date, DateTime, Decimal, Float, Identity, Integer, Time, Type

Constant Summary collapse

TYPES =
{}

Class Method Summary collapse

Class Method Details

.alias_type(new, old) ⇒ Object



392
393
394
# File 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb', line 392

def self.alias_type(new, old)
  TYPES[new] = TYPES[old]
end

.find_type(field) ⇒ Object



396
397
398
399
400
401
402
# File 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb', line 396

def self.find_type(field)
  if field.type == Mysql::Field::TYPE_TINY && field.length > 1
    TYPES[Mysql::Field::TYPE_LONG]
  else
    TYPES.fetch(field.type) { Fields::Identity.new }
  end
end

.register_type(type_id, type) ⇒ Object

Register an MySQL type_id with a typecasting object in type.



388
389
390
# File 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb', line 388

def self.register_type(type_id, type)
  TYPES[type_id] = type
end