Sha256: d5fddc13016ac7073b5e497a16a64c5368a6c474efdace5b1dcdf5c10e46593c
Contents?: true
Size: 963 Bytes
Versions: 10
Compression:
Stored size: 963 Bytes
Contents
if defined?(Mongoid) # Customize the error information Egregious returns for MongoidErrors module Mongoid module Errors class MongoidError def to_xml "<errors><error>#{HTMLEntities.new.encode(@problem || to_s)}</error><type>#{self.exception_type}</type></errors>" end def to_json "{\"error\":#{ActiveSupport::JSON.encode(@problem || to_s)}, \"type\":\"#{self.exception_type}\"}" end end class Validations def to_xml "<errors><error>#{HTMLEntities.new.encode(self.document.errors.full_messages.join(', ').gsub(/\r/, ' ').gsub(/\n/, ' ').squeeze(' '))}</error><type>#{self.exception_type}</type></errors>" end def to_json "{\"error\":#{ActiveSupport::JSON.encode(self.document.errors.full_messages.join(', ').gsub(/\r/, ' ').gsub(/\n/, ' ').squeeze(' '))}, \"type\":\"#{self.exception_type}\"}" end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems