📅  最后修改于: 2022-03-11 14:45:32.505000             🧑  作者: Mango
def self.find_by_id(id)
sql = <<-SQL
SELECT * FROM dogs WHERE id = ?
SQL
DB[:conn].execute(sql, id).map(){|row|
self.new_from_db(row)
}.first
end