Skip to content

Commit c916956

Browse files
committed
Rails2.3 - Coerced tests that ensure hash conditions on referenced tables are considered when eager loading with limit/offset. Information on these changes and the ticket in rails are.
1 parent 14eb27a commit c916956

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
MASTER
33

4+
* Rails2.3 - Coerced tests that ensure hash conditions on referenced tables are considered when eager
5+
loading with limit/offset. Information on these changes and the ticket in rails are.
6+
http://github.com/rails/rails/commit/9a4d557713acb0fc8e80f61af18094034aca029a
7+
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1404-conditions_tables-doesnt-understand-condition-hashes
8+
49
* Rails2.3 - Add coerced tests for true/false attributes in selects use SQL Server case statement. [Ken Collins]
510

611
* Making sure that smalldatetime types are OK to use. Also fixed a bug in the #view_information method that

test/cases/eager_association_test_sqlserver.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ class EagerAssociationTestSqlserver < ActiveRecord::TestCase
88

99
class EagerAssociationTest < ActiveRecord::TestCase
1010

11-
COERCED_TESTS = [:test_count_with_include]
11+
COERCED_TESTS = [
12+
:test_count_with_include,
13+
:test_eager_with_has_many_and_limit_and_high_offset_and_multiple_array_conditions,
14+
:test_eager_with_has_many_and_limit_and_high_offset_and_multiple_hash_conditions
15+
]
1216

1317
include SqlserverCoercedTest
1418

@@ -18,5 +22,21 @@ def test_coerced_test_count_with_include
1822
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "len(comments.body) > 15")
1923
end
2024

25+
def test_coerced_eager_with_has_many_and_limit_and_high_offset_and_multiple_array_conditions
26+
assert_queries(2) do
27+
posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :offset => 10,
28+
:conditions => [ "authors.name = ? and comments.body = ?", 'David', 'go crazy' ])
29+
assert_equal 0, posts.size
30+
end
31+
end
32+
33+
def test_coerced_eager_with_has_many_and_limit_and_high_offset_and_multiple_hash_conditions
34+
assert_queries(2) do
35+
posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :offset => 10,
36+
:conditions => { 'authors.name' => 'David', 'comments.body' => 'go crazy' })
37+
assert_equal 0, posts.size
38+
end
39+
end
40+
2141

2242
end

0 commit comments

Comments
 (0)