Sha256: 825e8fe59158c6f6e8b202184649736cc9a572e6081ae37611ca4ea9fe1d3771
Contents?: true
Size: 707 Bytes
Versions: 11
Compression:
Stored size: 707 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Fields #:nodoc: module Serializable #:nodoc: # Defines the behaviour for symbol fields. class Symbol include Serializable # Serialize the object from the type defined in the model to a MongoDB # compatible object to store. # # @example Serialize the field. # field.serialize(object) # # @param [ Object ] object The object to cast. # # @return [ Symbol ] The converted symbol. # # @since 2.1.0 def serialize(object) object.blank? ? nil : object.to_sym end alias :set :serialize end end end end
Version data entries
11 entries across 11 versions & 1 rubygems