From ace84a003cb48f60ca478c05c1fd8a57d37663cf Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 15 Nov 2010 20:24:58 -0800 Subject: support finding by a ruby class [#5979 state:resolved] --- activerecord/test/cases/relations_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/cases') 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]) -- cgit v1.2.3