Method: PureValidator::ValidationErrors#full_message
- Defined in:
- lib/pure_validator/validation_errors.rb
#full_message(attribute, message) ⇒ Object
Returns a full message for a given attribute.
errors.(:name, 'is invalid') # => "Name is invalid"
234 235 236 237 238 239 240 241 242 243 |
# File 'lib/pure_validator/validation_errors.rb', line 234 def (attribute, ) return if attribute == :base attr_name = humanize(attribute.to_s.tr('.', '_')) # attr_name = @base.class.human_attribute_name(attribute, default: attr_name) I18n.t(:"errors.format", { default: "%{attribute} %{message}", attribute: attr_name, message: }) end |