This module maps classes used in field type definitions to the custom definable field in Mongoid.
Get the custom field type for the provided class used in the field definition.
@example Get the mapping for the class.
Mappings.for(BSON::ObjectId)
@param [ Class ] klass The class to get the field type for.
@return [ Class ] The class of the custom field.
@since 2.1.0
# File lib/mongoid/fields/mappings.rb, line 22 def for(klass, foreign_key = false) return Serializable::Object unless klass if foreign_key return "#{MODULE}::ForeignKeys::#{klass.to_s.demodulize}".constantize end begin "#{MODULE}::#{klass.to_s.demodulize}".constantize rescue NameError klass end end
Generated with the Darkfish Rdoc Generator 2.