update field of record ruby on rails code example
Example: update a database in ruby
def update
sql = <<-SQL
UPDATE dogs SET name = ?, breed = ? WHERE id = ?
SQL
DB[:conn].execute(sql, self.name, self.breed, self.id)
end
def update
sql = <<-SQL
UPDATE dogs SET name = ?, breed = ? WHERE id = ?
SQL
DB[:conn].execute(sql, self.name, self.breed, self.id)
end