Closed apotonick closed 11 years ago
Yes we want that. If you just need coercion then use coercible gem.
Well I wanna take advantage of the brillant virtus API without having to fiddle with the coercible internals, which might change, etc. I just don't wanna virtus to override my constructor and acessors automatically. Right now, we use a separate coercion object in representable/roar/reform but it would be awesome if I could just include Virtus::Coercion
and get the upper behaviour.
Coercers will be exposed in virtus 1.0.0 w/o the need to build attribute instances. I guess that's what you need.
I was wondering if it is Virtus' job to create accessors for the model. I'd love to see the following basic behaviour for a setter (same applies to getter).
Here, virtus just coerces and then delegates responsibility for storing that attribute to the model.
Virtus could provide an additional module (per default) that adds setting and getting accessors to the model as it does now. But that should be optional!