Skip to content

Instantly share code, notes, and snippets.

@thomasmarren
Last active October 18, 2016 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasmarren/b2c79d960d55a2ef75cff82d0b86ed07 to your computer and use it in GitHub Desktop.
Save thomasmarren/b2c79d960d55a2ef75cff82d0b86ed07 to your computer and use it in GitHub Desktop.
#Ruby
def self.delete_by_name(name)
sql = "DELETE FROM users WHERE name = ?"
DB[:conn].execute(sql,name)
end
#Active Record
user = User.find_by(name: 'David')
user.destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment