Module: ClassyResources::SequelErrorsToXml

Defined in:
lib/classy_resources/sequel_errors_to_xml.rb

Instance Method Summary collapse

Instance Method Details

#to_xml(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/classy_resources/sequel_errors_to_xml.rb', line 5

def to_xml(options={})
  options[:root] ||= "errors"
  options[:indent] ||= 2
  options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])

  options[:builder].instruct! unless options.delete(:skip_instruct)
  options[:builder].errors do |e|
    full_messages.each { |msg| e.error(msg) }
  end
end