diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index 1f7e527eeb..7ac72acd58 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -282,6 +282,17 @@ module ActiveRecord end alias :create :insert_sql + def exec_insert(sql, name, binds) + binds = binds.dup + + # Pretend to support bind parameters + execute sql.gsub('?') { quote(*binds.shift.reverse) }, name + end + + def last_inserted_id(result) + @connection.last_id + end + def update_sql(sql, name = nil) super @connection.affected_rows