Included Modules

Class/Module Index [+]

Quicksearch

Grape::Exceptions::ValidationErrors

Attributes

errors[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/grape/exceptions/validation_errors.rb, line 10
def initialize(args = {})
  @errors = {}
  args[:errors].each do |validation_error|
    @errors[validation_error.params] ||= []
    @errors[validation_error.params] << validation_error
  end
  super message: full_messages.join(', '), status: 400
end

Public Instance Methods

as_json() click to toggle source
# File lib/grape/exceptions/validation_errors.rb, line 27
def as_json
  errors.map do |k, v|
    {
      params: k,
      messages: v.map(&:to_s)
    }
  end
end
each() click to toggle source
# File lib/grape/exceptions/validation_errors.rb, line 19
def each
  errors.each_pair do |attribute, errors|
    errors.each do |error|
      yield attribute, error
    end
  end
end
to_json() click to toggle source
# File lib/grape/exceptions/validation_errors.rb, line 36
def to_json
  as_json.to_json
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.