Rails 4.0 Sneak Peek: Expanded ActiveRecord Support for PostgreSQL Datatypes

Dan McClain

Partner & Developer

Dan McClain

This week, I had a pull request accepted into Rails which adds support for PostgreSQL’s MACADDR, INET, and CIDR datatypes. In Rails 4.0, the following migration will be supported:

create_table :network_types do |t|
  t.cidr :cidr_address
  t.inet :ip_address
  t.macaddr :mac_address

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.


Stay in the Know

Our latest articles and insights on all things digital product innovation, delivered straight to your inbox.

Narwin holding a press release sheet while opening the DockYard brand kit box