Sha256: d267b42ac5987aab4a279af25bbf2a1ed1d4aea714f3a414305c9d1f93155e88

Contents?: true

Size: 431 Bytes

Versions: 5

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: true

class PGTrunk::Operation
  # @private
  # Enable validation of the operation in the Rails way
  module Validations
    extend ActiveSupport::Concern

    class_methods do
      extend ActiveModel::Validations
    end

    def error_messages
      errors.messages.flat_map do |k, v|
        Array(v).map do |msg|
          k == :base ? msg : [k, msg].join(" ")
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_trunk-0.2.0 lib/pg_trunk/core/operation/validations.rb
pg_trunk-0.1.3 lib/pg_trunk/core/operation/validations.rb
pg_trunk-0.1.2 lib/pg_trunk/core/operation/validations.rb
pg_trunk-0.1.1 lib/pg_trunk/core/operation/validations.rb
pg_trunk-0.1.0 lib/pg_trunk/core/operation/validations.rb