Exception: Loaf::LoafError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/loaf/errors.rb

Overview

Default Loaf error for all custom errors.

Direct Known Subclasses

InvalidOptions

Constant Summary collapse

BASE_KEY =
"loaf.errors"

Instance Method Summary collapse

Instance Method Details

#error_message(key, attributes) ⇒ Object


10
11
12
# File 'lib/loaf/errors.rb', line 10

def error_message(key, attributes)
  translate(key, attributes)
end

#translate(key, options) ⇒ Object


14
15
16
# File 'lib/loaf/errors.rb', line 14

def translate(key, options)
  ::I18n.translate("#{BASE_KEY}.#{key}", { :locale => :en }.merge(options))
end