Prefer actual booleans in conditional expression

This commit is contained in:
Jared Beck 2016-03-13 14:51:26 -04:00
parent 48949c4ca0
commit 9aa1f16e88
1 changed files with 1 additions and 1 deletions

View File

@ -84,7 +84,7 @@ module PaperTrail
# and in Rails < 5, the []= uses the integer type caster from the column
# definition (in general) and thus will turn a (usually) string to 0 instead
# of the correct value
is_enum_without_type_caster = ::ActiveRecord::VERSION::MAJOR < 5 && enums[k]
is_enum_without_type_caster = ::ActiveRecord::VERSION::MAJOR < 5 && enums.key?(k)
if model.has_attribute?(k) && !is_enum_without_type_caster
model[k.to_sym] = v