mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Update YAML engine check for new Ruby versions
On Ruby 2.2.1, '::YAML' returns the class Psych, which has no ::ENGINE constant defined.
This commit is contained in:
parent
a98d88cb30
commit
237f7f7f09
1 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,8 @@ module PaperTrail
|
|||
# in the serialized object_changes
|
||||
def where_object_changes_condition(arel_field, field, value)
|
||||
# Need to check first (before) and secondary (after) fields
|
||||
if defined?(::YAML::ENGINE) && ::YAML::ENGINE.yamler == 'psych'
|
||||
if (defined?(::YAML::ENGINE) && ::YAML::ENGINE.yamler == 'psych') ||
|
||||
(defined?(::YAML) && defined?(Psych) && ::YAML == Psych)
|
||||
arel_field.matches("%\n#{field}:\n- #{value}\n%").
|
||||
or(arel_field.matches("%\n#{field}:\n-%\n- #{value}\n%"))
|
||||
else # Syck adds extra spaces into array dumps
|
||||
|
|
Loading…
Reference in a new issue