Sha256: cc45a8e04e6685e069ed64c90b735b676aa6b413166944f2838f7dfec814350d

Contents?: true

Size: 369 Bytes

Versions: 4

Compression:

Stored size: 369 Bytes

Contents

module Signaling::Base::Errors
  extend ActiveSupport::Concern

  included do
    attr_reader :errors
  end

  def initialize(*args)
    self.errors = {}
    super
  end

  def errors=(error_hash)
    @errors = ActiveModel::Errors.new(self)
    error_hash.each do |attr, errors|
      errors.each {|error| self.errors.add(attr, error) }
    end if error_hash
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
signaling-1.1.2 lib/signaling/base/errors.rb
signaling-1.1.1 lib/signaling/base/errors.rb
signaling-1.1.0 lib/signaling/base/errors.rb
signaling-1.0.0 lib/signaling/base/errors.rb