aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-29 10:46:35 +0900
committerGitHub <noreply@github.com>2018-01-29 10:46:35 +0900
commit3cf0973bc7aab24e2245dce66282e8be94c9d362 (patch)
treeff4828d0cb2e0617e2b3ae000e8ff6dc5d4196d4 /activerecord/lib
parente57e0a92e798d7d9cf2a37447e553ee67942526a (diff)
parentbbcb1c9e6bec7a517bb4d65e026d6e85d4a04ffb (diff)
downloadrails-3cf0973bc7aab24e2245dce66282e8be94c9d362.tar.gz
rails-3cf0973bc7aab24e2245dce66282e8be94c9d362.tar.bz2
rails-3cf0973bc7aab24e2245dce66282e8be94c9d362.zip
Merge pull request #31615 from cben/type_for_attribute-symbol
Allow type_for_attribute(:symbol)
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/model_schema.rb3
1 files changed, 2 insertions, 1 deletions
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