diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-06 13:05:58 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-06 13:05:58 -0700 |
commit | c713cf9a5d9db60c4387e74acb9de66e3e7f9b37 (patch) | |
tree | 07711a61950bb3c789261fb945feb60fe13a0896 /activerecord/test/cases | |
parent | d10d93225c6d9d4948400c22df4169075758ff8c (diff) | |
parent | f2a0dfc2985c008a618e1616f6cf9a4c54098c33 (diff) | |
download | rails-c713cf9a5d9db60c4387e74acb9de66e3e7f9b37.tar.gz rails-c713cf9a5d9db60c4387e74acb9de66e3e7f9b37.tar.bz2 rails-c713cf9a5d9db60c4387e74acb9de66e3e7f9b37.zip |
Merge pull request #1273 from jeremyf/feature-association-proxy-send
Addresses an inconsistency in the ActiveRecord::Base.method_missing handl
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 5a95e68eb4..0aaa0342b1 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -391,6 +391,15 @@ class RelationTest < ActiveRecord::TestCase assert_equal Post.find(1).last_comment, post.last_comment end + def test_dynamic_find_by_attributes_should_yield_found_object + david = authors(:david) + yielded_value = nil + Author.find_by_name(david.name) do |author| + yielded_value = author + end + assert_equal david, yielded_value + end + def test_dynamic_find_by_attributes david = authors(:david) author = Author.preload(:taggings).find_by_id(david.id) |