Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Errors::MongoidError

Default parent Mongoid error for all custom errors. This handles the base key for the translations and provides the convenience method for translating the messages.

Constants

BASE_KEY

Public Instance Methods

translate(key, options) click to toggle source

Given the key of the specific error and the options hash, translate the message.

@example Translate the message.

error.translate("errors", :key => value)

@param [ String ] key The key of the error in the locales. @param [ Hash ] options The objects to pass to create the message.

@return [ String ] A localized error message string.

# File lib/mongoid/errors/mongoid_error.rb, line 20
def translate(key, options)
  ::I18n.translate("#{BASE_KEY}.#{key}", options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.