Skip to content

Commit

Permalink
add ! to method name
Browse files Browse the repository at this point in the history
To make clear this method mutates the original object.
  • Loading branch information
vasconsaurus committed Feb 20, 2025
1 parent 5cd13f0 commit e4d1c9d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/project_association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def is_unique

def set_media
unless self.url.blank? && self.quote.blank? && self.file.blank? && self.media_type != 'Blank'
self.create_media
self.create_media!
self.media_id unless self.media_id.nil?
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/project_media_creators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_annotation
end
end

def create_media
def create_media!
self.set_media_type if self.set_original_claim || self.media_type.blank?
self.media = Media.find_or_create_media_associated_to(self)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/project_media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ProjectMedia < ApplicationRecord
validates_presence_of :custom_title, if: proc { |pm| pm.title_field == 'custom_title' }

before_validation :set_team_id, :set_channel, :set_project_id, on: :create
before_validation :create_media, if: proc { |pm| pm.set_original_claim.present? }, on: :create
before_validation :create_media!, if: proc { |pm| pm.set_original_claim.present? }, on: :create
after_create :create_annotation, :create_metrics_annotation, :send_slack_notification, :create_relationship, :create_team_tasks, :create_claim_description_and_fact_check, :create_tags_in_background
after_create :add_source_creation_log, unless: proc { |pm| pm.source_id.blank? }
after_commit :apply_rules_and_actions_on_create, :set_quote_metadata, :notify_team_bots_create, on: [:create]
Expand Down

0 comments on commit e4d1c9d

Please sign in to comment.