diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2015-12-31 19:45:47 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2015-12-31 19:46:05 -0300 |
commit | e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d (patch) | |
tree | 0524bb13d7d9fe66d122b094648b16efd04807d3 | |
parent | 8167fa4562841f4ae7ce307ce0c91a448a695ad9 (diff) | |
download | rails-e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d.tar.gz rails-e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d.tar.bz2 rails-e991c7b8cd69d7ba5e221a19e5f386e3ba02eb9d.zip |
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.
-rw-r--r-- | activerecord/lib/active_record/enum.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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) |