instance method
group_by_attribute
Ruby on Rails 7.1.6
Since v6.1.7.10Signature
group_by_attribute()
Returns a Hash of attributes with an array of their Error objects.
person.errors.group_by_attribute # => {:name=>[<#ActiveModel::Error>, <#ActiveModel::Error>]}
Source
# File activemodel/lib/active_model/errors.rb, line 289
def group_by_attribute
@errors.group_by(&:attribute)
end
Defined in activemodel/lib/active_model/errors.rb line 289
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors