Types supported by Rails Active Record

I’m always looking for those somewhere on web when I need them. Now I’m posting them here so I will always have them handy. If you need them then you can use this as a reference. Below is a list of supported types with its MySQL representation.

  • :primary_key – int(11) DEFAULT NULL auto_increment PRIMARY KEY
  • :stringvarchar(255)
  • :text – text
  • :integer – int limit 4
  • :float – float
  • :decimal – decimal
  • :datetime – datetime
  • :timestamp – datetime
  • :time – time
  • :date – date
  • :binary – blob
  • :boolean – tinyint(1)

It can also be found in this constant in ActiveRecord ConnectionAdapters MysqlAdapter


I think that all the other type mappings could be found in appropriate ActiveRecord Connection adapters.

Cheers, Gregster