From bbcb1c9e6bec7a517bb4d65e026d6e85d4a04ffb Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Mon, 1 Jan 2018 17:13:39 +0200 Subject: Allow type_for_attribute(:symbol) Closes #31611. --- activerecord/lib/active_record/model_schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/model_schema.rb') diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index fa7537c1a3..60823815fa 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -361,8 +361,9 @@ module ActiveRecord # it). # # +attr_name+ The name of the attribute to retrieve the type for. Must be - # a string + # a string or a symbol. def type_for_attribute(attr_name, &block) + attr_name = attr_name.to_s if block attribute_types.fetch(attr_name, &block) else -- cgit v1.2.3