Class Mongoid::Fields::Serializable::Localized
In: lib/mongoid/fields/serializable/localized.rb
Parent: Object

Defines the behaviour for localized string fields.

Methods

Included Modules

Serializable

Public Instance methods

Deserialize the object based on the current locale. Will look in the hash for the current locale.

@example Get the deserialized value.

  field.deserialize({ "en" => "testing" })

@param [ Hash ] object The hash of translations.

@return [ String ] The value for the current locale.

@since 2.3.0

Convert the provided string into a hash for the locale.

@example Serialize the value.

  field.serialize("testing")

@param [ String ] object The string to convert.

@return [ Hash ] The locale with string translation.

@since 2.3.0

[Validate]