Files
openfoodnetwork/app/models/spree/log_entry.rb
2020-09-01 09:46:41 +01:00

19 lines
405 B
Ruby

# frozen_string_literal: true
module Spree
class LogEntry < ActiveRecord::Base
belongs_to :source, polymorphic: true
# Fix for Spree #1767
# If a payment fails, we want to make sure we keep the record of it failing
after_rollback :save_anyway
def save_anyway
log = Spree::LogEntry.new
log.source = source
log.details = details
log.save!
end
end
end