Skip to content

Commit

Permalink
fix entry point automation name key not getting updated
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinSchneider committed May 15, 2024
1 parent e2b2645 commit 05358ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/app/models/concerns/indexable_json_key_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def index_key_values!(jsonb_column, *keys)
end

after_update do
if self.saved_change_to_attribute?(jsonb_column)
keys.each do |key|
next unless self.saved_changes[jsonb_column].try(:[], 0).try(:[], key) || self.saved_changes[jsonb_column].try(:[], 1).try(:[], key)
self.indexed_jsonb_keys.where(column: jsonb_column, key: key).update_all(value: self.send(jsonb_column).try(:[], key))
end
return if !self.saved_change_to_attribute?(jsonb_column)
keys.each do |key|
config_key_changed = ((self.saved_changes[jsonb_column] || [])[0] || {})[key] != ((self.saved_changes[jsonb_column] || [])[1] || {})[key]
next if !config_key_changed
self.indexed_jsonb_keys.where(column: jsonb_column, key: key).update_all(value: self.send(jsonb_column).try(:[], key))
end
end

Expand Down

0 comments on commit 05358ef

Please sign in to comment.