Skip to content
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

consider adding 'default' value to attr #24

Closed
weepy opened this issue Nov 13, 2012 · 5 comments
Closed

consider adding 'default' value to attr #24

weepy opened this issue Nov 13, 2012 · 5 comments

Comments

@weepy
Copy link

weepy commented Nov 13, 2012

ie.

model('Bucket')
.attr('count', { default: 0 })

@avetisk
Copy link

avetisk commented Nov 13, 2012

I guess that goes in the plugins section, considering that required is in that case.

Though, personally I would add both natively.

@tj
Copy link
Member

tj commented Nov 13, 2012

the nice thing about separating them is that you can easily craft your own "version" of model by forking, and adding those plugins as dependencies, removing any boilerplate you didn't want

@weepy
Copy link
Author

weepy commented Nov 13, 2012

yes that makes alot of sense. I did investigate that method, but wasn't sure how to go about doing it.
The model:initialize event would make this easier.

@tj
Copy link
Member

tj commented Nov 13, 2012

yup need the event first

@ianstormtaylor
Copy link
Contributor

Made a plugin that does this for you: https://github.com/segmentio/model-defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants