1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #40916 from alpaca-tc/reuse_activemodel_type_value

Reuse the same ActiveModel::Type::Value
This commit is contained in:
Ryuta Kamizono 2020-12-24 07:14:57 +09:00 committed by GitHub
commit 007a86506f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ module ActiveModel
end
module ClassMethods
def attribute(name, type = Type::Value.new, **options)
def attribute(name, type = Type.default_value, **options)
name = name.to_s
if type.is_a?(Symbol)
type = ActiveModel::Type.lookup(type, **options.except(:default))