Class: Chewy::Type::Adapter::Mongoid
- Defined in:
- lib/chewy/type/adapter/mongoid.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Orm
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Orm
#import, #import_fields, #initialize, #load, #name
Methods inherited from Base
#import, #import_fields, #import_references, #load, #name, #type_name
Constructor Details
This class inherits a constructor from Chewy::Type::Adapter::Orm
Class Method Details
.accepts?(target) ⇒ Boolean
7 8 9 10 11 |
# File 'lib/chewy/type/adapter/mongoid.rb', line 7 def self.accepts?(target) defined?(::Mongoid::Document) && ( target.is_a?(Class) && target.ancestors.include?(::Mongoid::Document) || target.is_a?(::Mongoid::Criteria)) end |
Instance Method Details
#identify(collection) ⇒ Object
13 14 15 |
# File 'lib/chewy/type/adapter/mongoid.rb', line 13 def identify(collection) super(collection).map { |id| id.is_a?(BSON::ObjectId) ? id.to_s : id } end |