From a7ef17696ffa2fb2edbfc1c19863b622ebeba299 Mon Sep 17 00:00:00 2001 From: mattbeedle Date: Sun, 8 Feb 2015 10:18:43 +0100 Subject: [PATCH] Add support for PostgreSQL jsonb columns --- lib/paper_trail/version_concern.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/paper_trail/version_concern.rb b/lib/paper_trail/version_concern.rb index e6f9e9aa..b8f48138 100644 --- a/lib/paper_trail/version_concern.rb +++ b/lib/paper_trail/version_concern.rb @@ -116,12 +116,12 @@ module PaperTrail # Returns whether the `object` column is using the `json` type supported by PostgreSQL def object_col_is_json? - @object_col_is_json ||= columns_hash['object'].type == :json + @object_col_is_json ||= [:json, :jsonb].include?(columns_hash['object'].type) end # Returns whether the `object_changes` column is using the `json` type supported by PostgreSQL def object_changes_col_is_json? - @object_changes_col_is_json ||= columns_hash['object_changes'].try(:type) == :json + @object_changes_col_is_json ||= [:json, :jsonb].include?(columns_hash['object_changes'].try(:type)) end end