Class: ActiveModel::BetterErrors::HumanMessageReporter
- Inherits:
-
MessageReporter
- Object
- Reporter
- MessageReporter
- ActiveModel::BetterErrors::HumanMessageReporter
- Defined in:
- lib/active_model/better_errors/human_message_reporter.rb
Overview
HumanMessageReporter
Instance Attribute Summary
Attributes inherited from Reporter
Instance Method Summary collapse
- #full_message(attribute, message) ⇒ Object
- #full_messages ⇒ Object
-
#generate_message(attribute, type = :invalid, options = {}) ⇒ Object
This method is not used internally.
Methods inherited from Reporter
Constructor Details
This class inherits a constructor from ActiveModel::BetterErrors::Reporter
Instance Method Details
#full_message(attribute, message) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_model/better_errors/human_message_reporter.rb', line 18 def (attribute, ) return if attribute == :base str = attribute.to_s.gsub('.', '_').humanize str = base.class.human_attribute_name(attribute, default: str) I18n.t( 'errors.format', default: '%{attribute} %{message}', attribute: str, message: ) end |
#full_messages ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_model/better_errors/human_message_reporter.rb', line 9 def @collection.map do |attribute, | = ::ActiveModel::BetterErrors.( base, ) attribute, end end |
#generate_message(attribute, type = :invalid, options = {}) ⇒ Object
This method is not used internally. This is for API Compatibility with ActiveModel::Errors only
33 34 35 36 |
# File 'lib/active_model/better_errors/human_message_reporter.rb', line 33 def (attribute, type = :invalid, = {}) = ErrorMessage.build(base, attribute, type, ) ::ActiveModel::BetterErrors.(base, ) end |