self find by id

Solutions on MaxInterview for self find by id by the best coders in the world

showing results for - "self find by id"
Bautista
15 Jan 2020
1def self.find_by_id(id)
2    sql = <<-SQL
3    SELECT * FROM dogs WHERE id = ?
4    SQL
5
6    DB[:conn].execute(sql, id).map(){|row|
7      self.new_from_db(row)
8    }.first
9  end
similar questions
queries leading to this page
self find by id