Sha256: 020a697558c2c68d1c3d04b8e105b990da104cdf2d5eb905aa9d8ecb1937ad7c
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
require 'builder' require Ruboss4Ruby::LIB_DIR + 'configuration' # Flex friendly DataMapper patches, more specifically we just add +to_xml+ on # ValidationErrors class module DataMapper # see DataMapper docs for more details module Validate # By default DataMapper validation errors doesn't have +to_xml+ method. This is # actually very useful when dealing with remote stateful clients such as Flex/AIR. class ValidationErrors # Add Flex-friendly +to_xml+ implementation def to_xml xml = Builder::XmlMarkup.new(:indent => 2) xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8" xml.errors do |e| @errors.each_key do |attribute| @errors[attribute].each do |msg| next if msg.nil? if attribute == "base" e.error("message" => msg) else e.error("field" => attribute.to_s.camelcase(:lower), "message" => msg) end end end end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems