We're saving IPv4 addresses into the database as 32 bit integers, but we work 
with them as Strings when loaded.  But even though the Property claims the 
value given is valid.  It refuses to save, with the message: "IpAddress must be 
an integer".

Full Property definition here: https://gist.github.com/1062969

So for example:


class Example
    include DataMapper::Resource
  
    property :id, Serial
    property :ip_address, IPAddressInteger
end

example = Example.new
example.ip_address = "10.48.1.1"

example.valid?
# => false

Example.properties[:ip_address].valid?(example.ip_address)
# => true

example.save
# => false

What's going on here?  I've tried defining the property as a subclass of 
String, but that doesn't help.  I've also overridden the Property's #valid? 
method, which cause the resources #valid? to return true, but the subsequent 
save to return false.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to