From c368b660be2433e291a2c87b3eb3de3dfac397ef Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 1 Nov 2012 14:27:45 -0200 Subject: Ensure calling first/last with options correctly set inverse association Also related to #8087. Thanks @al2o3cr. --- activerecord/test/cases/associations/inverse_associations_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 533192ea0e..0cab6faa25 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -261,10 +261,18 @@ class InverseHasManyTests < ActiveRecord::TestCase def test_parent_instance_should_be_shared_with_first_and_last_child man = Man.first + assert man.interests.first.man.equal? man assert man.interests.last.man.equal? man end + def test_parent_instance_should_be_shared_with_first_and_last_child_when_given_options + man = Man.first + + assert man.interests.first(:order => 'topic').man.equal? man + assert man.interests.last(:order => 'topic').man.equal? man + end + def test_parent_instance_should_be_shared_with_first_n_and_last_n_children man = Man.first -- cgit v1.2.3