to_xml(options={}) public

Returns an xml formatted representation of the Errors hash.

  p.errors.add(:name, "can't be blank")
  p.errors.add(:name, "must be specified")
  p.errors.to_xml
  # =>
  #  <?xml version=\"1.0\" encoding=\"UTF-8\"?>
  #  <errors>
  #    <error>name can't be blank</error>
  #    <error>name must be specified</error>
  #  </errors>
Show source
Register or log in to add new notes.