Skip to content

key not found: :coercion_method when using Object type #19

Closed
d11wtq opened this Issue Jul 31, 2011 · 4 comments

2 participants

@d11wtq
d11wtq commented Jul 31, 2011

Just updated to 0.0.6 and starting getting this error on classes where I'm using Object as an attribute type.

class Example
  include Virtus

  attribute :foo, Object
end
KeyError: key not found: :coercion_method
    from /home/chris/.rvm/gems/ruby-1.9.2-p290@flippa/gems/virtus-0.0.6/lib/virtus/attribute.rb:98:in `fetch'
    from /home/chris/.rvm/gems/ruby-1.9.2-p290@flippa/gems/virtus-0.0.6/lib/virtus/attribute.rb:98:in `initialize'
    from /home/chris/.rvm/gems/ruby-1.9.2-p290@flippa/gems/virtus-0.0.6/lib/virtus/class_methods.rb:46:in `new'
    from /home/chris/.rvm/gems/ruby-1.9.2-p290@flippa/gems/virtus-0.0.6/lib/virtus/class_methods.rb:46:in `attribute'
    from (irb):4:in `<class:Example>'
    from (irb):2
    from /home/chris/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'

I think I'll just use attr_accessor for these attributes for now, but it's nice to be consistent when there are a list of related attributes and some of those are just Object types.

@solnic
Owner
solnic commented Jul 31, 2011

Oh boy! I'll fix it later today and push 0.0.7. Thanks for the bug report

@solnic solnic closed this in b7c4d5f Jul 31, 2011
@solnic
Owner
solnic commented Jul 31, 2011

@d11wtq Dude can you grab sources from master and see if it works for you now? Thanks!

@solnic
Owner
solnic commented Jul 31, 2011

@d11wtq actually nevermind, I checked it myself :) new release is on rubygems already: https://rubygems.org/gems/virtus/versions/0.0.7

@d11wtq
d11wtq commented Aug 1, 2011

Great, thanks, 0.0.7 works for us.

(Sorry for the delay, I was ZzzZzz'ing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.