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

value has the right type here

using `enum kind: [ :any, :income, :expense ]` syntax, value is already an
integer and using `enum kind: { any: 'any', income: 'income', expense:
'expense' }` syntax value is a string.

This allows us to define the mapping in the enum definition.

This reverts commit 933decceaf.
This commit is contained in:
Santiago Pastorino 2015-12-31 19:45:47 -03:00
parent 8167fa4562
commit e991c7b8cd

View file

@ -124,7 +124,7 @@ module ActiveRecord
def deserialize(value)
return if value.nil?
mapping.key(value.to_i)
mapping.key(value)
end
def serialize(value)