Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/mongo_record/core_ext.rb
Overview
Mongo stores trees of JSON-like documents. These to_mongo_value
methods covert objects to Hash values, which are converted by the Mongo driver to the proper types.
Instance Method Summary collapse
-
#instance_values ⇒ Object
From Rails.
-
#to_mongo_value ⇒ Object
Convert an Object to a Mongo value.
Instance Method Details
#instance_values ⇒ Object
From Rails
27 28 29 30 31 32 |
# File 'lib/mongo_record/core_ext.rb', line 27 def instance_values #:nodoc: instance_variables.inject({}) do |values, name| values[name.to_s[1..-1]] = instance_variable_get(name) values end end |
#to_mongo_value ⇒ Object
Convert an Object to a Mongo value. Used by MongoRecord::Base when saving data to Mongo.
22 23 24 |
# File 'lib/mongo_record/core_ext.rb', line 22 def to_mongo_value self end |