Sha256: b7295c2db83b1a31bb5a36717e47c427e0c976c68354e868699010993a91a188

Contents?: true

Size: 373 Bytes

Versions: 15

Compression:

Stored size: 373 Bytes

Contents

module Scimitar
  module Errors
    def add_errors_from_hash(errors_hash, prefix: nil)
      errors_hash.each_pair do |key, value|
        new_key = prefix.nil? ? key : "#{prefix}.#{key}".to_sym
        if value.is_a?(Array)
          value.each {|error| errors.add(new_key, error)}
        else
          errors.add(new_key, value)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
scimitar-1.6.0 app/models/scimitar/errors.rb
scimitar-1.5.3 app/models/scimitar/errors.rb
scimitar-1.5.2 app/models/scimitar/errors.rb
scimitar-1.5.0 app/models/scimitar/errors.rb
scimitar-1.4.0 app/models/scimitar/errors.rb
scimitar-1.3.3 app/models/scimitar/errors.rb
scimitar-1.3.1 app/models/scimitar/errors.rb
scimitar-1.3.0 app/models/scimitar/errors.rb
scimitar-1.2.1 app/models/scimitar/errors.rb
scimitar-1.2.0 app/models/scimitar/errors.rb
scimitar-1.1.0 app/models/scimitar/errors.rb
scimitar-1.0.3 app/models/scimitar/errors.rb
scimitar-1.0.2 app/models/scimitar/errors.rb
scimitar-1.0.1 app/models/scimitar/errors.rb
scimitar-1.0.0 app/models/scimitar/errors.rb