Method: ActiveModel::Errors#attribute_names

Defined in:
activemodel/lib/active_model/errors.rb

#attribute_namesObject

Returns all error attribute names

person.errors.messages        # => {:name=>["cannot be nil", "must be specified"]}
person.errors.attribute_names # => [:name]


237
238
239
# File 'activemodel/lib/active_model/errors.rb', line 237

def attribute_names
  @errors.map(&:attribute).uniq.freeze
end