Method: ActiveModel::Attributes#attribute_names
- Defined in:
- activemodel/lib/active_model/attributes.rb
#attribute_names ⇒ Object
Returns an array of attribute names as strings.
class Person
include ActiveModel::Attributes
attribute :name, :string
attribute :age, :integer
end
person = Person.new
person.attribute_names # => ["name", "age"]
146 147 148 |
# File 'activemodel/lib/active_model/attributes.rb', line 146 def attribute_names @attributes.keys end |