diff options
Diffstat (limited to 'app/helpers/jsonld_helper.rb')
-rw-r--r-- | app/helpers/jsonld_helper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb index 9d2b6cf00..532397272 100644 --- a/app/helpers/jsonld_helper.rb +++ b/app/helpers/jsonld_helper.rb @@ -73,8 +73,10 @@ module JsonLdHelper end end - def body_to_json(body) - body.is_a?(String) ? Oj.load(body, mode: :strict) : body + def body_to_json(body, compare_id: nil) + json = body.is_a?(String) ? Oj.load(body, mode: :strict) : body + return if compare_id.present? && json['id'] != compare_id + json rescue Oj::ParseError nil end |