Flowdock
method

attributes

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 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(name: 'Francesco', age: 22)
person.attributes
# => {"name"=>"Francesco", "age"=>22}
Show source
Register or log in to add new notes.