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



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

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

#translate(key, options) ⇒ Object



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

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