Rails 4.0 Sneak Peek: Expanded ActiveRecord Support for PostgreSQL Datatypes
1 2 3 4 5
create_table :network_types do |t| t.cidr :cidr_address t.inet :ip_address t.macaddr :mac_address end
Also, the schema dumper supports these types as well (previously they
would appear as
string types in the schema.rb file).
ActiveRecord will also cast the values of the INET and CIDR types to Ruby's IPAddr, while MACADDR will continue to be converted to a string.