module ActiveRecord::AttributeMethods
def attributes
person.attributes
person = Person.create(name: 'Francesco', age: 22)
end
class Person < ActiveRecord::Base
Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
def attributes @attributes.to_hash end