Sha256: 19153835abeb6eaffb24092ce62995da0b52fc31e8cd136a12a171ca55584329

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

module ObjectAttorney

  module Errors
    # ActiveModel::Errors told me to declare
    # the following methods for a minimal implementation

    module ClassMethods
      def human_attribute_name(attribute, _ = {})
        attribute
      end

      # Having doubts if this is really necessary
      # def lookup_ancestors
      #   [self]
      # end
    end

    def self.included(base_class)
      base_class.extend ActiveModel::Naming
      base_class.extend ClassMethods
    end

    def errors
      @errors ||= ActiveModel::Errors.new(self)
    end

    def read_attribute_for_validation(attribute)
      send(attribute)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object_attorney-3.0.2 lib/object_attorney/errors.rb