Permalink
Browse files

Revert "Do not dup the binds when visiting the AST"

This reverts commit 71ff7d9.

Reason: I need to check with @jeremy if we can do this.
  • Loading branch information...
1 parent bf2c428 commit ccecf17b9b40ca60f5ac7281247f3e798820ce12 Rafael Mendonça França + Kassio Borges committed Aug 31, 2013
View
3 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -9,6 +9,7 @@ def initialize
# 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
@@ -376,7 +377,7 @@ def delete_sql(sql, name = nil)
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
View
2 activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -229,7 +229,7 @@ def exec_query(sql, name = 'SQL', binds = [])
alias exec_without_stmt exec_query
- # Returns an ActiveRecord::Result instance.
+ # Returns an ActiveRecord::Result instance.
def select(sql, name = nil, binds = [])
exec_query(sql, name)
end
View
8 activerecord/test/cases/base_test.rb
@@ -329,14 +329,6 @@ def test_create_after_initialize_with_array_param
assert !cbs[1].frickinawesome
end
- def test_create_without_prepared_statement
- cb = CustomBulb.connection.unprepared_statement do
- CustomBulb.create(name: 'Dude')
- end
-
- assert_equal('Dude', cb.name)
- end
-
def test_load
topics = Topic.all.merge!(:order => 'id').to_a
assert_equal(4, topics.size)

0 comments on commit ccecf17

Please sign in to comment.