-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
I resisted suggesting this for years, but the issue is keep coming back. I think it's time to fix it.
Problem
I want to provide a default when value is not given e.g. new html form, but allow user to clear value if needed.
integer :num, default: 100- Currently it's impossible to allow nil, while providing default
defaultsyntax is confusing, as the behavior differs from Rails. I've seen many devs confused by this.
Proposed solution
Separate current default behavior into two options: default and allow_nil.
integer :num, default: 100, allow_nil: trueallow_nilis chosen to match rails validations syntax and being self explanatory.- no surprises,
defaultis a default,allow_nilallows nil.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels