Skip to content

Instantly share code, notes, and snippets.

@skojin
Created October 9, 2013 10:04
Show Gist options
  • Save skojin/6899009 to your computer and use it in GitHub Desktop.
Save skojin/6899009 to your computer and use it in GitHub Desktop.
module UpdateIgnore
def update_ignore(updates, conditions)
set = updates.map{|k,v| "#{connection.quote_column_name(k)} = #{connection.quote v}" }.join(', ')
connection.update "UPDATE IGNORE #{quoted_table_name} SET #{set} WHERE #{self.where(conditions).where_clauses.join('AND')}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment