mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
There were a few changes needed: * Plugins are now specified through `plugin:` config keyword. * All plugin gems need to be specified explicitly in Gemfile since they are no longer dependencies of plugins already specified explicitly. * All plugin gems need to be updated in other to use the new APIs. * One cop was renamed. * New offenses safe to correct were corrected directly with `bundle exec rubocop -a`. * New offenses unsafe to correct were added to the TODO configuration with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp`.
23 lines
506 B
Ruby
23 lines
506 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'active_support/concern'
|
|
|
|
module LogDestroyPerformer
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
attr_accessor :destroyed_by
|
|
|
|
after_destroy :log_who_destroyed
|
|
|
|
def log_who_destroyed
|
|
message = if destroyed_by.nil?
|
|
"#{self.class} #{id} deleted"
|
|
else
|
|
"#{self.class} #{id} deleted by #{destroyed_by.id} <#{destroyed_by.email}>"
|
|
end
|
|
Rails.logger.info message
|
|
end
|
|
end
|
|
end
|