Closed MichaelXavier closed 10 years ago
In DM1 what we did was add a :required
option. We defaulted to false
, but I think in this specific case we would want to default to true. To override it, you would then do:
class Foo
include Virtus.model(strict: true)
attribute :bar, String, required: false
end
I'm not sure what api @solnic has planned, but I always found this quite nice.
Yeah I guess :required would be OK. With axiom-types we can set lots of different constraints so that's cool. I just want to somehow make it clear that virtus doesn't have any validation system and it shouldn't be confused with it.
@MichaelXavier this is now available in beta7
Wow. I file this ticket and go to bed. Wake up and it is on rubygems. Thanks!
@MichaelXavier :smile: I hope it works for you
Not sure what the solution is but this is not possible
Not sure the best way to express an attribute accepts nil but seems like a common use case. I don't think it fundamentally conflicts with strict.