diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-04-26 17:29:22 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-04-26 18:04:41 +0100 |
commit | 759d302db851754a73ec4c74e951f8a5faf2bee1 (patch) | |
tree | b66b66f316f9cec57735197e59472f8ea52e9b0a /activerecord/test/cases/associations/inner_join_association_test.rb | |
parent | f6ddb13113ac5cb4e75a7d041a1ff15a036fa0f3 (diff) | |
download | rails-759d302db851754a73ec4c74e951f8a5faf2bee1.tar.gz rails-759d302db851754a73ec4c74e951f8a5faf2bee1.tar.bz2 rails-759d302db851754a73ec4c74e951f8a5faf2bee1.zip |
remove deprecate #calculate calls
Diffstat (limited to 'activerecord/test/cases/associations/inner_join_association_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/inner_join_association_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb index 68a1e62328..1d61d5c474 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -72,17 +72,17 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase def test_count_honors_implicit_inner_joins real_count = Author.scoped.to_a.sum{|a| a.posts.count } - assert_equal real_count, Author.count(:joins => :posts), "plain inner join count should match the number of referenced posts records" + assert_equal real_count, Author.joins(:posts).count, "plain inner join count should match the number of referenced posts records" end def test_calculate_honors_implicit_inner_joins real_count = Author.scoped.to_a.sum{|a| a.posts.count } - assert_equal real_count, Author.calculate(:count, 'authors.id', :joins => :posts), "plain inner join count should match the number of referenced posts records" + assert_equal real_count, Author.joins(:posts).calculate(:count, 'authors.id'), "plain inner join count should match the number of referenced posts records" end def test_calculate_honors_implicit_inner_joins_and_distinct_and_conditions real_count = Author.scoped.to_a.select {|a| a.posts.any? {|p| p.title =~ /^Welcome/} }.length - authors_with_welcoming_post_titles = Author.calculate(:count, 'authors.id', :joins => :posts, :distinct => true, :conditions => "posts.title like 'Welcome%'") + authors_with_welcoming_post_titles = Author.scoped(:joins => :posts, :where => "posts.title like 'Welcome%'").calculate(:count, 'authors.id', :distinct => true) assert_equal real_count, authors_with_welcoming_post_titles, "inner join and conditions should have only returned authors posting titles starting with 'Welcome'" end |