From e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 31 Dec 2015 19:45:47 -0300 Subject: 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 933decceaf6092020ba7ba768b51b2db9d5b882f. --- activerecord/lib/active_record/enum.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 7ded96f8fb..04519f4dc3 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -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) -- cgit v1.2.3