Tuesday, 15 May 2012

ruby on rails - Using the IPAddress Gem As a Custom Field in Mongoid -



ruby on rails - Using the IPAddress Gem As a Custom Field in Mongoid -

i'm trying utilize ipaddress custom field mongoid document monkey patching serialization methods ipaddress module , can't seem it...

class computer include mongoid::document field :ip_address, type: ipaddress end module ipaddress def mongoize to_string end def self.mongoize(object) object.to_string end def self.demongoize(string) ipaddress.new string end def self.evolve(object) object.to_string end end

here's got right second... i've tried lots of other ways , can't find 1 works. help much appreciated!

ruby-on-rails ruby mongoid3

No comments:

Post a Comment