Sha256: ed4ca59ad18c99f5f9192c6a4e6e26753835ba1f04875b2a8e110492198d468e
Contents?: true
Size: 695 Bytes
Versions: 17
Compression:
Stored size: 695 Bytes
Contents
class Journaled::ChangeDefinition attr_reader :attribute_names, :logical_operation def initialize(attribute_names:, logical_operation:) @attribute_names = attribute_names.map(&:to_s) @logical_operation = logical_operation @validated = false end def validated? @validated end def validate!(model) nonexistent_attribute_names = attribute_names - model.class.attribute_names raise <<~ERROR if nonexistent_attribute_names.present? Unable to persist #{model} because `journal_changes_to, as: #{logical_operation.inspect}` includes nonexistant attributes: #{nonexistent_attribute_names.join(', ')} ERROR @validated = true end end
Version data entries
17 entries across 17 versions & 1 rubygems