-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initializing attributes by default #61
Comments
What about specifying the default as an empty string, eg: attribute :name, String, :default => '' |
Hm, so |
You could do this too: attribute :address, Address, :default => proc { Address.new } Although I wouldn't be surprised if your approach works too. Virtus will |
@dkubb if ´Addresse |
@senny I wonder if we should make it so value objects are also |
oh wait, nevermind that won't work. Singleton instances are 1:1 with the class names, while value objects only need to have one instance per distinct value. |
@senny so yeah, to answer your question, yes, I think we should do that :) What I'm thinking is we should make it so that |
@dkubb Thanks! This is what I've got so far for my form library. https://img.skitch.com/20120209-pewtuuecpkubktpnts2iinbbu1.png (same idea as https://github.com/joshsusser/informal, but better) |
@solnic I think this can be closed. |
Is it possible to get virtus to do something like:
I'm building a form handling library based on virtus, and not having to deal with nil's would make this a lot easier.
The text was updated successfully, but these errors were encountered: