Class: Pigeon::ChannelErrors

Inherits:
ActiveModel::Errors
  • Object
show all
Defined in:
lib/pigeon/errors.rb

Overview

Same as ActiveModel::Errors, except it calls human_attribute_name on the instance instead of the class

Instance Method Summary collapse

Instance Method Details

#full_message(attribute, message) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/pigeon/errors.rb', line 18

def full_message(attribute, message)
  return message if attribute == :base
  attr_name = attribute.to_s.tr('.', '_').humanize
  attr_name = @base.human_attribute_name(attribute, :default => attr_name)                                                          
  I18n.t(:"errors.format", {
    :default   => "%{attribute} %{message}",
    :attribute => attr_name,
    :message   => message
  })  
end