solnic / virtus

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

possible to dynamically add attributes? #366

Open joshco opened 7 years ago

joshco commented 7 years ago

Is it possible to dynamically add attributes to a Virtus model?
I'm building a form builder, and when I load the Virtus model, I want to pass a collection of attributes to a method I define. I want that method to add those attributes so they behave as if they were defined by the attribute method in Virtus itself.

nruth commented 7 years ago

https://github.com/solnic/virtus#dynamically-extending-instances should let you do that?