From 71ff7d9c6592b93e2c810a1f464943dd7bd02c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 27 Aug 2013 23:49:25 -0300 Subject: Do not dup the binds when visiting the AST The visitor have to consume the bind parameters to make the statements work when the prepared statement option is disabled. Fixes #12023 --- .../active_record/connection_adapters/abstract/database_statements.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 32244b1755..ce63b5b4df 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -9,7 +9,6 @@ module ActiveRecord # Converts an arel AST to SQL def to_sql(arel, binds = []) if arel.respond_to?(:ast) - binds = binds.dup visitor.accept(arel.ast) do quote(*binds.shift.reverse) end @@ -377,7 +376,7 @@ module ActiveRecord def sql_for_insert(sql, pk, id_value, sequence_name, binds) [sql, binds] end - + def last_inserted_id(result) row = result.rows.first row && row.first -- cgit v1.2.3