Sha256: 8af66f39828251d76ed9b61c970e4482233d67333e0a0145acaf7aaa9d42ed8f

Contents?: true

Size: 374 Bytes

Versions: 30

Compression:

Stored size: 374 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

30 entries across 30 versions & 2 rubygems

Version Path
scimitar-1.11.0 app/models/scimitar/errors.rb
scimitar-2.10.0 app/models/scimitar/errors.rb
scimitar-1.10.0 app/models/scimitar/errors.rb
scimitar-2.9.0 app/models/scimitar/errors.rb
scimitar-2.8.0 app/models/scimitar/errors.rb
scimitar-2.7.3 app/models/scimitar/errors.rb
powerhome-scimitar-1.0.0 app/models/scimitar/errors.rb
scimitar-2.7.2 app/models/scimitar/errors.rb
scimitar-1.8.2 app/models/scimitar/errors.rb
scimitar-1.8.1 app/models/scimitar/errors.rb
scimitar-2.7.1 app/models/scimitar/errors.rb
scimitar-1.8.0 app/models/scimitar/errors.rb
scimitar-2.7.0 app/models/scimitar/errors.rb
scimitar-1.7.1 app/models/scimitar/errors.rb
scimitar-2.6.1 app/models/scimitar/errors.rb
scimitar-1.7.0 app/models/scimitar/errors.rb
scimitar-2.6.0 app/models/scimitar/errors.rb
scimitar-2.5.0 app/models/scimitar/errors.rb
scimitar-2.4.3 app/models/scimitar/errors.rb
scimitar-2.4.2 app/models/scimitar/errors.rb