diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-15 20:24:58 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-15 20:25:43 -0800 |
commit | ace84a003cb48f60ca478c05c1fd8a57d37663cf (patch) | |
tree | 347c325ef8944acb62956b3d57071e1944b52d9e /activerecord/test | |
parent | 7bf9cbb7667d3725535c1410df95892891665a95 (diff) | |
download | rails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.tar.gz rails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.tar.bz2 rails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.zip |
support finding by a ruby class [#5979 state:resolved]
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 24539df6ff..e39b1f396c 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -438,6 +438,13 @@ class RelationTest < ActiveRecord::TestCase assert_equal author, authors.first end + class Mary < Author; end + + def test_find_by_classname + Author.create!(:name => Mary.name) + assert_equal 1, Author.where(:name => Mary).size + end + def test_find_by_id_with_list_of_ar author = Author.first authors = Author.find_by_id([author]) |