Created
September 24, 2016 05:45
-
-
Save saadbinakhlaq/1d841ea3360acf150647269df6131e00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BSON | |
class ObjectId | |
def to_json(*args) | |
to_s.to_json | |
end | |
def as_json(*args) | |
to_s.as_json | |
end | |
end | |
end | |
module Mongoid | |
module Document | |
def serializable_hash(options = nil) | |
hash = super(options) | |
hash['id'] = hash.delete('_id') if(hash.has_key?('_id')) | |
hash | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment