Method: Lev::Error#full_message

Defined in:
lib/lev/error.rb

#full_messageObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/lev/error.rb', line 31

def full_message
  attribute = data[:attribute] if data.present?
  return message.humanize if attribute.nil?

  attr_name = attribute.to_s.gsub('.', '_').humanize

  model = data[:model]
  attr_name = model.class.human_attribute_name(attribute, default: attr_name) if model.present?

  I18n.t(:"errors.format", {
    default:   "%{attribute} %{message}",
    attribute: attr_name,
    message:   message
  })
end