Method: ActiveModel::Attributes::ClassMethods#attribute_names

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

#attribute_namesObject

Returns an array of attribute names as strings.

class Person
  include ActiveModel::Attributes

  attribute :name, :string
  attribute :age, :integer
end

Person.attribute_names # => ["name", "age"]


74
75
76
# File 'activemodel/lib/active_model/attributes.rb', line 74

def attribute_names
  attribute_types.keys
end