Sha256: d160ce32fbf17db459aa65a845bacfc1ef1c2973c1685db9e6fe11176901d4ea
Contents?: true
Size: 726 Bytes
Versions: 2
Compression:
Stored size: 726 Bytes
Contents
# frozen_string_literal: true 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
journaled-6.0.0 | app/models/journaled/change_definition.rb |
journaled-5.3.2 | app/models/journaled/change_definition.rb |