Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created May 29, 2012 16:47
Show Gist options
  • Select an option

  • Save practicingruby/2829478 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/2829478 to your computer and use it in GitHub Desktop.
def update(id, params)
# FIXME: This is not secure
sql = params.map { |k,v| "#{k} = #{v.inspect}" }.join(", ")
# BrokenRecord.database is just an instance of Sqlite::Database
BrokenRecord.database.execute %{
update #{@table_name}
set #{sql}
where id = #{id}
}
end
@steveklabnik

Copy link
Copy Markdown

Ahhhhhhh. My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment