solnic / virtus

[DISCONTINUED ] Attributes on Steroids for Plain Old Ruby Objects
MIT License
3.77k stars 228 forks source link

Expose the name of the attribute failing coercion #263

Closed ntl closed 10 years ago

ntl commented 10 years ago

Resolves #254

Currently, when you include Virtus.model(strict: true), and you fail to supply any of the attributes, the exception message doesn't let you know which attribute was missing. This can lead to painful debugging sessions, particularly when a model embeds other models.

This pull request attempts to address that by providing visibility into the name of the attribute that could not be coerced. Since not all Virtus::Attribute instances actually have a name, we fall back to the old message when one isn't present.

solnic commented 10 years ago

Thanks! :heart:

karlfreeman commented 10 years ago

:heart:

tsyber1an commented 10 years ago

:heart:

ntl commented 10 years ago

Much appreciated! :heart:

elskwid commented 10 years ago

Nice job @ntl!