You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
400 B

class Person
# connect to postgres
DB = PG.connect(host: "localhost", port: 5432, dbname: 'contacts')
def self.all
results = DB.exec("SELECT * FROM people;")
results.each do |result|
puts result
end
[
{ name: 'Joey', age:12 },
{ name: 'Sarah', age:52 },
{ name: 'Cthulhu', age: 8000 }
]
end
end