Permalink
Browse files

Merge pull request #12383 from marclennox/master

Fixed issue #12327
Conflicts:
	activerecord/test/cases/base_test.rb
  • Loading branch information...
1 parent 3117fb6 commit 6a6740790f58c69ad2c03213ae66bbfe6030ba60 @rafaelfranca rafaelfranca committed Sep 29, 2013
@@ -157,8 +157,8 @@ def exec_query(sql, name = 'SQL', binds = [])
def exec_delete(sql, name = 'SQL', binds = [])
log(sql, name, binds) do
- result = binds.empty? ? exec_no_cache(sql, binds) :
- exec_cache(sql, binds)
+ result = without_prepared_statement?(binds) ? exec_no_cache(sql, binds) :
+ exec_cache(sql, binds)
affected = result.cmd_tuples
result.clear
affected
@@ -572,6 +572,15 @@ def test_create_without_prepared_statement
assert_equal topic, Topic.find(topic.id)
end
+ def test_destroy_without_prepared_statement
+ topic = Topic.create(title: 'foo')
+ Topic.connection.unprepared_statement do
+ Topic.find(topic.id).destroy
+ end
+
+ assert_equal nil, Topic.find_by_id(topic.id)
+ end
+
def test_comparison_with_different_objects
topic = Topic.create
category = Category.create(:name => "comparison")

0 comments on commit 6a67407

Please sign in to comment.