Skip to content

Commit

Permalink
CV2-5391: use save instead of save! to avoid raising error (#2061)
Browse files Browse the repository at this point in the history
* CV2-5391: use save instead of save! to avoid raising error

* CV2-5391: fix archived validation error
  • Loading branch information
melsawy authored Oct 1, 2024
1 parent eaf9d8e commit 6cae6c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/bot/smooch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ def self.save_text_message(message)
end

def self.create_project_media(message, type, extra)
extra.merge!({ archived: message['archived'] })
extra.merge!({ archived: message['archived'] }) unless message['archived'].blank?
channel_value = self.get_smooch_channel(message)
extra.merge!({ channel: {main: channel_value }}) unless channel_value.nil?
pm = ProjectMedia.create!({ media_type: type, smooch_message: message }.merge(extra))
Expand Down
2 changes: 1 addition & 1 deletion app/models/relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def self.create_unless_exists(source_id, target_id, relationship_type, options =
options.each do |key, value|
r.send("#{key}=", value) if r.respond_to?("#{key}=")
end
r.save!
r.save ? r : nil
end
r
end
Expand Down

0 comments on commit 6cae6c3

Please sign in to comment.