method
attributes
v7.1.3.2 -
Show latest stable
- Class:
ActiveModel::Attributes
attributes()public
Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
class Person include ActiveModel::Attributes attribute :name, :string attribute :age, :integer end person = Person.new person.name = "Francesco" person.age = 22 person.attributes # => { "name" => "Francesco", "age" => 22}