-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 [I951] false object import bug (#952)
* 🐛 Add guard to prevent method calls on newly created object Imports were failing for active fedora applications because ordered_memebers is an undefined method for FalseClass. object gets assigned by #find, which intentionally returns false for new objects; we can't find something that doesn't exist. Issue: - #951 * 🧹 refactor methods into a shareable module * 🐛 fix ContentUpdateEventJob retries ContentUpdateEventJob would fail and retry over and over again. This is because we were passing it a nil user. Similar issue (previously fixed): - #656
- Loading branch information
1 parent
855ce39
commit bf7bc5c
Showing
3 changed files
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module Loggable | ||
extend ActiveSupport::Concern | ||
|
||
def log_created(obj) | ||
log_action('Created', obj) | ||
end | ||
|
||
def log_updated(obj) | ||
log_action('Updated', obj) | ||
end | ||
|
||
def log_deleted_fs(obj) | ||
msg = "Deleted All Files from #{obj.id}" | ||
Rails.logger.info("#{msg} (#{Array(obj.attributes[work_identifier]).first})") | ||
end | ||
|
||
private | ||
|
||
def log_action(action, obj) | ||
msg = "#{action} #{obj.class.model_name.human} #{obj.id}" | ||
Rails.logger.info("#{msg} (#{Array(obj.attributes[work_identifier]).first})") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters