From f13b278568a1d629dd4d90b16ed87b715c4e689d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 27 Aug 2013 23:41:29 -0300 Subject: Check if the SQL is not a prepared statement When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023 --- activerecord/test/cases/base_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index dc2de7b523..e3b441280b 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -565,6 +565,14 @@ class BasicsTest < ActiveRecord::TestCase assert_equal [topic_2, topic_1].sort, [topic_1, topic_2] end + def test_create_without_prepared_statement + topic = Topic.connection.unprepared_statement do + Topic.create(:title => 'foo') + end + + assert_equal topic, Topic.find(topic.id) + end + def test_comparison_with_different_objects topic = Topic.create category = Category.create(:name => "comparison") -- cgit v1.2.3