-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
Using virtus 1.0.3 I get this behavior when attempting custom coercion with an array:
class MyInt < Virtus::Attribute
def coerce(value)
value.to_i
end
end
class Thing
include Virtus.model
attribute :int, MyInt
attribute :ints, Array[MyInt]
end
Thing.new(:int => '1', :ints => ['1', '2'])
#<Thing:0x007f9b309a74a0 @int=1, @ints=["1", "2"]>According to the readme this seems like it should work...
As you can see, the "int" field was coerced but the "ints" array was not. Is this a bug or am I doing something wrong?
Reactions are currently unavailable