aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-15 20:24:58 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-15 20:25:43 -0800
commitace84a003cb48f60ca478c05c1fd8a57d37663cf (patch)
tree347c325ef8944acb62956b3d57071e1944b52d9e /activerecord/test/cases
parent7bf9cbb7667d3725535c1410df95892891665a95 (diff)
downloadrails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.tar.gz
rails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.tar.bz2
rails-ace84a003cb48f60ca478c05c1fd8a57d37663cf.zip
support finding by a ruby class [#5979 state:resolved]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/relations_test.rb7
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])