-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
In my models I use to set a callback to nilify blank json/jsonb values (and the whole column if it's just empty), in the following way:
before_save :nilify_blank_stored_attributes
def nilify_blank_stored_attributes
self.class.stored_attributes.keys.each do |stored_attribute|
send(stored_attribute).delete_if{|k,v| v.blank?}
send(stored_attribute.to_s.concat('=').intern, nil) if send(stored_attribute).empty?
end
endHow about adding this feature?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels