Skip to content

Add an ActiveModel Custom Serializer to allow Storage of a CIDR IP Address (V4 or V6) in a String Column

License

Notifications You must be signed in to change notification settings

msimkins/ip_address_serializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Dependency Status

IpAddressSerializer

This gem providers a custom Serializer for ActiveRecord to allow the storage and retrieval of an IPv4 or IPv6 Address in a String Field

Installation

Add this line to your application's Gemfile:

gem 'ip_address_serializer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ip_address_serializer

Usage

Once the Gem has been added to your Gemfile, in any model that is required to hold an IP Address, add the following line to your model

serialize <field name symbol>, IPAddressSerializer

Contributing

  1. Fork it ( https://github.com/msimkins/ip_address_serializer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Add an ActiveModel Custom Serializer to allow Storage of a CIDR IP Address (V4 or V6) in a String Column

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages