1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/models/history_value.rb

40 lines
783 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'checksum'
# Setting values, kept history of modifications
2020-03-25 10:16:47 +01:00
class HistoryValue < ApplicationRecord
2018-12-17 16:02:02 +01:00
belongs_to :setting
belongs_to :invoicing_profile
after_create :chain_record
def chain_record
self.footprint = compute_footprint
save!
2020-07-21 19:25:21 +02:00
FootprintDebug.create!(
footprint: footprint,
data: FootprintService.footprint_data(HistoryValue, self, 'created_at'),
klass: HistoryValue.name
)
end
def check_footprint
footprint == compute_footprint
end
2020-07-21 19:25:21 +02:00
def debug_footprint
FootprintService.debug_footprint(HistoryValue, self)
end
def user
invoicing_profile.user
end
private
def compute_footprint
2019-09-18 15:09:14 +02:00
FootprintService.compute_footprint(HistoryValue, self, 'created_at')
end
2018-12-17 16:02:02 +01:00
end