Permalink
Browse files

test case for #3951 => failing

  • Loading branch information...
1 parent 7730655 commit 6c44155ac26603c22af31ef63c887b1ecda1ba99 @senny committed Dec 2, 2012
@@ -1313,6 +1313,10 @@ def test_has_many_through_respects_hash_conditions
assert_equal authors(:david).hello_post_comments, authors(:david).hello_post_comments_with_hash_conditions
end
+ def test_has_many_scope_lets_you_override_default_join_condition
+ assert_not_equal [], authors(:david).comments_with_relation
+ end
+
def test_include_uses_array_include_after_loaded
firm = companies(:first_firm)
firm.clients.load_target
@@ -23,6 +23,7 @@ def testing_proxy_target
has_one :post_about_thinking, -> { where("posts.title like '%thinking%'") }, :class_name => 'Post'
has_one :post_about_thinking_with_last_comment, -> { where("posts.title like '%thinking%'").includes(:last_comment) }, :class_name => 'Post'
has_many :comments, :through => :posts
+ has_many :comments_with_relation, ->(author) { joins(:post).where('posts.author_id = ?', author.id) }, :class_name => 'Comment'
has_many :comments_containing_the_letter_e, :through => :posts, :source => :comments
has_many :comments_with_order_and_conditions, -> { order('comments.body').where("comments.body like 'Thank%'") }, :through => :posts, :source => :comments
has_many :comments_with_include, -> { includes(:post) }, :through => :posts, :source => :comments

0 comments on commit 6c44155

Please sign in to comment.