diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-06-24 20:23:38 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-06-24 20:23:38 +0000 |
commit | c8e2cf3ed0c35205ff80bded5232924685f5904a (patch) | |
tree | 998f54b2b8aa180f3968692df825311066da28da | |
parent | 28012e68fe2837207a9319a24c541eabfc5b3ff7 (diff) | |
download | rails-c8e2cf3ed0c35205ff80bded5232924685f5904a.tar.gz rails-c8e2cf3ed0c35205ff80bded5232924685f5904a.tar.bz2 rails-c8e2cf3ed0c35205ff80bded5232924685f5904a.zip |
Pass association finder arguments through to the association class exactly as we received them. Fixes case where parent.children.find() is interpreted as Child.find([]) instead of Child.find().
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1498 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 4 | ||||
-rwxr-xr-x | activerecord/test/associations_test.rb | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 9e94d70972..21879adb77 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -78,7 +78,9 @@ module ActiveRecord options[:order] = @options[:order] end - @association_class.find(args.size == 1 ? args.first : args, options) + # Pass through args exactly as we received them. + args << options + @association_class.find(*args) end end diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 6fb8757153..52dc1a7359 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -316,7 +316,7 @@ class HasManyAssociationsTest < Test::Unit::TestCase end def test_find_ids - firm = Firm.find_first + firm = Firm.find(:first) assert_raises(ActiveRecord::RecordNotFound) { firm.clients.find } |