Ticket #8801: hmt_collection_count_uniq.patch
| File hmt_collection_count_uniq.patch, 1.2 kB (added by lifofifo, 2 years ago) |
|---|
-
activerecord/test/associations/join_model_test.rb
old new 29 29 def test_has_many_uniq_through_join_model 30 30 assert_equal 2, authors(:mary).categorized_posts.size 31 31 assert_equal 1, authors(:mary).unique_categorized_posts.size 32 assert_equal 1, authors(:mary).unique_categorized_posts.count 32 33 end 33 34 34 35 def test_polymorphic_has_many -
activerecord/lib/active_record/associations/has_many_through_association.rb
old new 99 99 def sum(*args, &block) 100 100 calculate(:sum, *args, &block) 101 101 end 102 103 def count(*args) 104 (@reflection.options[:uniq] ? load_target.size : @reflection.klass.send(:with_scope, construct_scope) { @reflection.klass.count(*args) }) 105 end 102 106 103 107 protected 104 108 def method_missing(method, *args, &block)