aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-01 14:27:45 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-01 14:27:57 -0200
commitc368b660be2433e291a2c87b3eb3de3dfac397ef (patch)
treea10d3df18ce149e294c5f1b221999fd8b625c7b9 /activerecord/test/cases
parentd37d40b2d702e9ff1461a3571f7f4d7ec52c2a2a (diff)
downloadrails-c368b660be2433e291a2c87b3eb3de3dfac397ef.tar.gz
rails-c368b660be2433e291a2c87b3eb3de3dfac397ef.tar.bz2
rails-c368b660be2433e291a2c87b3eb3de3dfac397ef.zip
Ensure calling first/last with options correctly set inverse association
Also related to #8087. Thanks @al2o3cr.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/inverse_associations_test.rb8
1 files changed, 8 insertions, 0 deletions
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