Browse files

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 933decc.
  • Loading branch information...
1 parent 8167fa4 commit e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d @spastorino spastorino committed Dec 31, 2015
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/enum.rb
@@ -124,7 +124,7 @@ def cast(value)
def deserialize(value)
return if value.nil?
- mapping.key(value.to_i)
+ mapping.key(value)
def serialize(value)

0 comments on commit e991c7b

Please sign in to comment.