instance method
full_messages_for
Ruby on Rails 6.1.7.10
Since v4.0.13Signature
full_messages_for(attribute)
Returns all the full error messages for a given attribute in an array.
class Person validates_presence_of :name, :email validates_length_of :name, in: 5..30 end person = Person.create() person.errors.full_messages_for(:name) # => ["Name is too short (minimum is 5 characters)", "Name can't be blank"]
Parameters
-
attributereq
Source
# File activemodel/lib/active_model/errors.rb, line 492
def full_messages_for(attribute)
where(attribute).map(&:full_message).freeze
end
Defined in activemodel/lib/active_model/errors.rb line 492
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors