📜  self.find_by_id - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:32.505000             🧑  作者: Mango

代码示例1
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