bluemonk/ipaddress — pull request #52 by gauthier-delacroix (2014-09-15 16:38:12+00:00)
Title: Add Mongoid support

Mongoid `IPAddress` field support.

`lib/ipaddress/mongoid.rb` is only required when `Mongoid` is defined.

If you agree this PR, I can update the README about this feature, but maybe you'll prefer keeping this as an external gem, which I'd perfectly understand.

Note that I'll also have to PR https://github.com/fnando/validators to allow `IPAddress` objects to be validated instead of strings only.

Quick usage example:
````ruby
class Node
include Mongoid::Document
field :name, type: String
field :ip, type: IPAddress
end

node = Node.new(name: "Server1", ip: "192.168.1.1")
node.ip
#=> # nil
````
I could also add some other features to ease searches, like finding addresses contained in a network, etc., which I'm already doing in my app code.