This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
IPAddress Property does not typecast Resolv::IPv4 / Resolv::IPv6 objects #48
Milestone
Comments
ArgumentError: +value+ must be nil or a String from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-types-1.2.0/lib/dm-types/ip_address.rb:28:in `load' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-types-1.2.0/lib/dm-types/ip_address.rb:37:in `typecast_to_primitive' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/property.rb:686:in `typecast' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/property.rb:625:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource/persistence_state.rb:22:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource/persistence_state/transient.rb:14:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/model/property.rb:237:in `address=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource.rb:333:in `block in attributes=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource.rb:329:in `each' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource.rb:329:in `attributes=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/resource.rb:748:in `initialize' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/property/discriminator.rb:33:in `new' from /home/hal/.rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/property/discriminator.rb:33:in `new' |
@postmodern can you reproduce it on current master? |
Confirmed on master (ddf9682): require 'dm-core' require 'dm-types' require 'resolv' class Test include DataMapper::Resource property :id, Serial property :ip, IPAddress end DataMapper.finalize ip = Resolv::DNS.new(:nameserver => '4.2.2.1').getaddress('www.google.com') t = Test.new(:ip => ip) ArgumentError: +value+ must be nil or a String from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-types-ddf96829985c/lib/dm-types/ip_address.rb:21:in `load' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-types-ddf96829985c/lib/dm-types/ip_address.rb:30:in `typecast' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/property.rb:618:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource/persistence_state.rb:22:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource/persistence_state/transient.rb:14:in `set' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/model/property.rb:237:in `ip=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource.rb:333:in `block in attributes=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource.rb:329:in `each' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource.rb:329:in `attributes=' from /home/hal/.rvm/gems/ruby-1.9.2-p290/bundler/gems/dm-core-d74ae6e8c4a3/lib/dm-core/resource.rb:748:in `initialize' from (irb):16:in `new' from (irb):16 from /home/hal/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `' |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you create a
Resolv::DNS
object to query a specific nameserver, it will returnResolv::IPv4
/Resolv::IPv6
objects instead of Strings. The IPAddress Property does not typecast these objects.The text was updated successfully, but these errors were encountered: