Class: BSON::ObjectId

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/extensions.rb

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object



3
4
5
# File 'lib/mongoid/extensions.rb', line 3

def as_json(options = nil)
  { "$oid" => to_s }
end

#to_xml(options = nil) ⇒ Object



6
7
8
# File 'lib/mongoid/extensions.rb', line 6

def to_xml(options = nil)
  ActiveSupport::XmlMini.to_tag(options[:root], self.to_s, options)
end