Module: CleanErrors

Defined in:
lib/clean_errors.rb,
lib/clean_errors/version.rb,
lib/clean_errors/validation_error.rb

Defined Under Namespace

Classes: ValidationError

Constant Summary collapse

VERSION =
'1.0.1'

Class Method Summary collapse

Class Method Details

.translation_pathObject



17
18
19
# File 'lib/clean_errors.rb', line 17

def translation_path
  @path || "errors"
end

.translation_path=(value) ⇒ Object



21
22
23
# File 'lib/clean_errors.rb', line 21

def translation_path= value
  @path = value
end

.ValidationError(type, i18n_data = {}) ⇒ Object Also known as: Error



9
10
11
12
13
14
# File 'lib/clean_errors.rb', line 9

def ValidationError(type, i18n_data={})
  CleanErrors::ValidationError.new(
    type: type,
    message: I18n.t("#{translation_path}.#{type}") % i18n_data
  )
end