Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Update import_document.rb
Browse files Browse the repository at this point in the history
Fixes #266 - Use nil for empty attributes
  • Loading branch information
ewlarson committed Mar 19, 2023
1 parent b033cbe commit d595597
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/models/import_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ def to_hash
{
friendlier_id: friendlier_id,
title: title,
json_attributes: json_attributes,
json_attributes: nullify_empty_json_attributes,
import_id: import_id
}
end

def nullify_empty_json_attributes
clean_hash = {}

json_attributes.each do |key, value|
clean_hash[key] = value.present? ? value : nil
end

clean_hash
end
end

0 comments on commit d595597

Please sign in to comment.