2011-03-08 15:05:07 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2010-06-03 20:20:53 +00:00
|
|
|
require 'mongoid'
|
|
|
|
|
2012-01-10 01:24:34 +00:00
|
|
|
module Mongoid#:nodoc:
|
|
|
|
module Document #:nodoc:
|
2011-12-22 01:59:30 +00:00
|
|
|
def as_json(options = {})
|
2011-12-21 14:24:39 +00:00
|
|
|
attrs = super(options)
|
|
|
|
attrs["id"] = attrs["_id"]
|
|
|
|
attrs
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-10 01:24:34 +00:00
|
|
|
module Fields #:nodoc:
|
|
|
|
module Internal #:nodoc:
|
|
|
|
class RawArray < Mongoid::Fields::Internal::Array
|
|
|
|
def resizable?; false; end
|
|
|
|
end
|
|
|
|
end
|
2011-03-08 15:05:07 +00:00
|
|
|
|
2012-01-10 01:24:34 +00:00
|
|
|
class RawArray < ::Array; end
|
|
|
|
end
|
2011-04-28 15:04:18 +00:00
|
|
|
|
|
|
|
# without callback feature
|
2012-01-10 01:24:34 +00:00
|
|
|
module Callbacks #:nodoc:
|
|
|
|
module ClassMethods #:nodoc:
|
2011-04-28 15:04:18 +00:00
|
|
|
def without_callback(*args, &block)
|
|
|
|
skip_callback(*args)
|
|
|
|
yield
|
|
|
|
set_callback(*args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-03-08 15:05:07 +00:00
|
|
|
end
|