class ActiveModel::Errors

def details

Returns a Hash of attributes with an array of their error details.
def details
  hash = group_by_attribute.transform_values do |errors|
    errors.map(&:details)
  end
  hash.default = EMPTY_ARRAY
  hash.freeze
  hash
end