Ticket #6778: fix_6778.patch
| File fix_6778.patch, 1.9 kB (added by jonathan_viney, 2 years ago) |
|---|
-
test/finder_test.rb
old new 442 442 :conditions => "posts.id <= 3 OR posts.#{QUOTED_TYPE} = 'Post'") 443 443 end 444 444 end 445 446 def test_find_ignores_previously_inserted_record 447 post = Post.create! 448 assert_equal [], Post.find(:all, :conditions => 'id is null') 449 end 445 450 446 451 def test_find_by_empty_ids 447 452 assert_equal [], Post.find([]) -
lib/active_record/connection_adapters/mysql_adapter.rb
old new 387 387 end 388 388 @connection.real_connect(*@connection_options) 389 389 execute("SET NAMES '#{encoding}'") if encoding 390 391 # By default, MySQL will find the id of the last inserted row when doing 392 # a SELECT with conditions such as "id is null". Turn off this unwanted behaviour. 393 # http://dev.rubyonrails.org/ticket/6778 394 execute("SET SQL_AUTO_IS_NULL=0") 390 395 end 391 396 392 397 def select(sql, name = nil) -
CHANGELOG
old new 1 1 *SVN* 2 2 3 * Set variable on MySQL connection to ignore recently inserted records when querying with 'id is null'. Closes #6778 [Jonathan Viney] 4 3 5 * Consolidated different create and create! versions to call through to the base class with scope. This fixes inconsistencies, especially related to protected attribtues. Closes #5847 [Alexander Dymo, Tobias Luetke] 4 6 5 7 * find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. #6764 [vitaly, Jeremy Kemper]