Sha256: eb901c6331f117771b50bbfe58c1513daf1e4185d668f21785412d9234370c06
Contents?: true
Size: 670 Bytes
Versions: 6
Compression:
Stored size: 670 Bytes
Contents
require 'sc_core/errors/supply_chain_error_codes' module ActiveModel class ErrorMessage < String attr_accessor :code, :message def initialize(code , message) @code , @message = code , message super message end end class Errors def add(attribute, message = nil, options = {}) message ||= :invalid code = SupplyChainErrorCodes::ArMapping[message] if message.is_a?(Symbol) message = generate_message(attribute, message, options.except(*CALLBACKS_OPTIONS)) elsif message.is_a?(Proc) message = message.call end self[attribute] << ErrorMessage.new(code , message) end end end
Version data entries
6 entries across 1 versions & 1 rubygems