Changeset 7328
- Timestamp:
- 08/16/07 04:58:45 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-stable/activerecord/CHANGELOG
r7327 r7328 1 1 *SVN* 2 3 * Don't clobber includes passed to has_many.count [danger] 2 4 3 5 * Make sure has_many uses :include when counting [danger] branches/1-2-stable/activerecord/lib/active_record/associations/has_many_association.rb
r7327 r7328 51 51 @finder_sql : 52 52 @finder_sql + " AND (#{sanitize_sql(options[:conditions])})" 53 options[:include] = @reflection.options[:include]53 options[:include] ||= @reflection.options[:include] 54 54 55 55 @reflection.klass.count(column_name, options) branches/1-2-stable/activerecord/test/associations/eager_test.rb
r7327 r7328 168 168 posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :conditions => "posts.title = 'magic forest'") 169 169 assert_equal 0, posts.size 170 end 171 172 def test_eager_count_performed_on_a_has_many_association_with_multi_table_conditional 173 author = authors(:david) 174 author_posts_without_comments = author.posts.select { |post| post.comments.blank? } 175 assert_equal author_posts_without_comments.size, author.posts.count(:all, :include => :comments, :conditions => 'comments.id is null') 170 176 end 171 177