Merge pull request #733 from airblade/actual_booleans_plz

Prefer actual booleans in conditional expression
This commit is contained in:
Jared Beck 2016-03-13 15:29:11 -04:00
commit 973b89df39
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