1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
This commit is contained in:
Rafael Mendonça França 2014-04-11 15:46:04 -03:00
parent d447eef20b
commit 8a08f5cb23
3 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ module ActiveRecord
def proxy_association
@association
end
def size
@association.size
end
@ -16,7 +16,7 @@ module ActiveRecord
def empty?
@association.empty?
end
private
def exec_queries

View file

@ -1197,7 +1197,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
author = Author.includes(:posts).references(:posts).reorder(:name).find_by('posts.title IS NOT NULL')
assert_equal authors(:bob), author
end
test "preloading with a polymorphic association and using the existential predicate but also using a select" do
assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer
@ -1205,7 +1205,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
authors(:david).essays.includes(:writer).select(:name).any?
end
end
test "preloading with a polymorphic association and using the existential predicate" do
assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer

View file

@ -826,14 +826,14 @@ class RelationTest < ActiveRecord::TestCase
def test_select_with_aggregates
posts = Post.select(:title, :body)
assert_equal 11, posts.count(:all)
assert_equal 11, posts.size
assert posts.any?
assert posts.many?
assert ! posts.empty?
assert ! posts.empty?
end
def test_select_takes_a_variable_list_of_args
david = developers(:david)