Path: | lib/sequel/extensions/pg_inet.rb |
Last Update: | Fri Jul 13 14:52:09 +0000 2012 |
The pg_inet extension adds support for Sequel to handle PostgreSQL‘s inet and cidr types using ruby‘s IPAddr class.
This extension integrates with Sequel‘s native postgres adapter, so that when inet/cidr fields are retrieved, they are returned as IPAddr instances
After loading the extension, you should extend your dataset with a module so that it correctly handles the inet/cidr type:
DB.extend Sequel::Postgres::InetDatabaseMethods
If you are not using the native postgres adapter, you probably also want to use the typecast_on_load plugin in the model, and set it to typecast the inet/cidr column(s) on load.
This extension does not add special support for the macaddr type. Ruby doesn‘t have a stdlib class that represents mac addresses, so these will still be returned as strings.