Skip to content

Commit

Permalink
UDF #19 - Updating fieldable concern to treat user_defined attribute …
Browse files Browse the repository at this point in the history
…as JSON
  • Loading branch information
dleadbetter committed Sep 27, 2022
1 parent 4fff0bd commit 69a90c7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/models/concerns/user_defined_fields/fieldable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def validate_user_defined_fields
next unless field.required?

# Parse the user defined field and extract the value
json = JSON.parse(self.user_defined || '{}')
value = json[field.column_name]
value = self.user_defined[field.column_name] if self.user_defined.present?

# Add an error if the value is "empty"
next unless value.nil? ||
Expand Down

0 comments on commit 69a90c7

Please sign in to comment.