solnic/virtus — pull request #66 by mbj (2012-02-13 12:15:28+00:00)
Title: Fix primitive for embedded value

This pull request removes EmbeddedValue#model and uses EmbeddedValue#primitive.

This is needed so I can use Aequitas Rule::PrimitiveType::Virtus. Aequitas uses EmbeddedValue#value_coerced?(value) internaly. Before this patch EmbeddedValue#primitive always returns ::Object, so value_ocerced?(value) always fails.

It would also be possible to simply override Attribute#value_coerced to not compare @primitive === value, and instead doing @model === value. But IMHO it is better to remove code than to add. My pull request uses the present "Primitive" infrastructure this is the way to go.

As a side note, since I needed to use OpenStruct as default primitive, I could remove the pending spec on Attribute.detect_type whith embedded values.

Feel free to comment, since this is my first contribution to virtus it is likely I missed some important points.