instance method
full_message
Ruby on Rails 5.2.8.1
Since v3.2.22.5Signature
full_message(attribute, message)
Returns a full message for a given attribute.
person.errors.full_message(:name, 'is invalid') # => "Name is invalid"
Parameters
-
attributereq -
messagereq
Source
# File activemodel/lib/active_model/errors.rb, line 367
def full_message(attribute, message)
return message if attribute == :base
attr_name = attribute.to_s.tr(".", "_").humanize
attr_name = @base.class.human_attribute_name(attribute, default: attr_name)
I18n.t(:"errors.format",
default: "%{attribute} %{message}",
attribute: attr_name,
message: message)
end
Defined in activemodel/lib/active_model/errors.rb line 367
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors