OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/costs/deleted_user_fallback.rb

24 lines
574 B

module OpenProject::Costs
module DeletedUserFallback
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :user, :deleted_user_fallback
end
end
module InstanceMethods
def user_with_deleted_user_fallback(force_reload = true)
associated_user = user_without_deleted_user_fallback(force_reload)
if associated_user.nil? && read_attribute(:user_id).present?
associated_user = DeletedUser.first
end
associated_user
end
end
end
end