class Mongoid::Criteria::Queryable::Smash
This is a smart hash for use with options and selectors.
Private Instance Methods
localized_key(name, serializer)
click to toggle source
Get the localized value for the key if needed. If the field uses localization the current locale will be appended to the key in MongoDB dot notation.
@api private
@example Get the normalized key name.
smash.localized_key("field", serializer)
@param [ String ] name The name of the field. @param [ Object ] serializer The optional field serializer.
@return [ String ] The normalized key.
@since 1.0.0
# File lib/custom_fields/extensions/mongoid/criteria/queryable/smash.rb, line 25 def localized_key(name, serializer) serializer&.localized? ? "#{name}.#{::Mongoid::Fields::I18n.locale}" : name end