-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Hi,
Please consider adding the following features to nilify_blanks.
- Add an 'after' option similar to that of 'before'
- Allow it to be used by the more general ActiveModel::Model instead of just ActiveRecord::Base
The reasoning is that it can be useful to apply nilify_blanks in after_initialize, so that we can treat all attributes consistently (not only ones that are saved into DB, but also ones that are not yet saved, and even ones that are not DB columns).
It's true that the initial intent was to provide consistency for stored DB values. But it's better if this consistency also applies at code (ruby) level, so we know that unspecified values are always nil.
This consistency can then be taken to a higher level, whereby non-DB-backed models (ActiveModel::Model) also have the same behaviour.
Thank you
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels