class ActiveModel::Errors

def to_hash(full_messages = false)

person.errors.to_hash(true) # => {:name=>["name cannot be nil"]}
person.errors.to_hash # => {:name=>["cannot be nil"]}

is +true+, it will contain full messages (see +full_message+).
Returns a Hash of attributes with their error messages. If +full_messages+
def to_hash(full_messages = false)
  if full_messages
    messages.each_with_object({}) do |(attribute, array), messages|
      messages[attribute] = array.map { |message| full_message(attribute, message) }
    end
  else
    without_default_proc(messages)
  end
end