Method: ActiveRecord::AttributeMethods#attribute_names

Defined in:
lib/active_record/attribute_methods.rb

#attribute_namesObject

Returns an array of names for the attributes available on this object.

class Person < ActiveRecord::Base
end

person = Person.new
person.attribute_names
# => ["id", "created_at", "updated_at", "name", "age"]


314
315
316
# File 'lib/active_record/attribute_methods.rb', line 314

def attribute_names
  @attributes.keys
end