method

attributes

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: 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}
Show source
Register or log in to add new notes.