Exception: ActiveRecord::Bixformer::AttributeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/activerecord-bixformer/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(attribute, value, type = :invalid, options = {}) ⇒ AttributeError

Returns a new instance of AttributeError.



24
25
26
27
28
# File 'lib/activerecord-bixformer/error.rb', line 24

def initialize(attribute, value, type = :invalid, options = {})
  @attribute = attribute.model.translate(attribute.name)

  super(generate_message(attribute, type, value, options))
end

Instance Method Details

#full_messageObject



30
31
32
# File 'lib/activerecord-bixformer/error.rb', line 30

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