Permalink
Browse files

Merge pull request #1120 from lysenko/collection_singular_ids

collection_singular_ids ignores association :include option
  • Loading branch information...
2 parents c6578d6 + 66dd2d3 commit 1bad08f1168709a657110281f9a9e17c514eda92 @spastorino spastorino committed Jul 7, 2011
@@ -50,7 +50,7 @@ def ids_reader
else
column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}"
- scoped.select(column).except(:includes).map! do |record|
+ scoped.select(column).map! do |record|
record.send(reflection.association_primary_key)
end
end
@@ -714,6 +714,11 @@ def test_get_has_many_through_belongs_to_ids_with_conditions
assert_equal [categories(:general).id], authors(:mary).categories_like_general_ids
end
+ def test_get_collection_singular_ids_on_has_many_through_with_conditions_and_include
+ person = Person.first
+ assert_equal person.posts_with_no_comment_ids, person.posts_with_no_comments.map(&:id)
+ end
+
def test_count_has_many_through_with_named_scope
assert_equal 2, authors(:mary).categories.count
assert_equal 1, authors(:mary).categories.general.count

0 comments on commit 1bad08f

Please sign in to comment.