From e6cc2ea201857a5f3700f589336df2880564cfea Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 4 Nov 2011 11:16:55 +0000 Subject: Allow the :class_name option for associations to take a symbol. This is to avoid confusing newbies, and to be consistent with the fact that other options like :foreign_key already allow a symbol or a string. --- activerecord/test/cases/reflection_test.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 4d21822cf5..3868ecb3cb 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -189,7 +189,7 @@ class ReflectionTest < ActiveRecord::TestCase def test_reflection_of_all_associations # FIXME these assertions bust a lot - assert_equal 36, Firm.reflect_on_all_associations.size + assert_equal 37, Firm.reflect_on_all_associations.size assert_equal 26, Firm.reflect_on_all_associations(:has_many).size assert_equal 10, Firm.reflect_on_all_associations(:has_one).size assert_equal 0, Firm.reflect_on_all_associations(:belongs_to).size @@ -325,6 +325,10 @@ class ReflectionTest < ActiveRecord::TestCase assert_equal orig_conds, Post.reflect_on_association(:first_blue_tags_2).conditions.inspect end + def test_symbol_for_class_name + assert_equal Client, Firm.reflect_on_association(:unsorted_clients_with_symbol).klass + end + private def assert_reflection(klass, association, options) assert reflection = klass.reflect_on_association(association) -- cgit v1.2.3