Permalink
Browse files

Merge pull request #12383 from marclennox/master

Fixed issue #12327
  • Loading branch information...
2 parents 94f63f8 + 747ccb0 commit 414d1eaf6cd9333fe0c4123ba8d7157946505a3b @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
@@ -566,6 +566,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_blank_ids
one = Subscriber.new(:id => '')
two = Subscriber.new(:id => '')

0 comments on commit 414d1ea

Please sign in to comment.