Sha256: ade19c28e3dcc44129a0bc23efa2918b0aa87dc09efaf1d6a6016c0cb2a329b8
Contents?: true
Size: 831 Bytes
Versions: 23
Compression:
Stored size: 831 Bytes
Contents
module Eco module API class MicroCases # Helper to preserve the original `default_tag`. # @note # 1. It only works if the original value of `default_tag` was **not** empty # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done. # @param options [Hash] the options. # @return [String] the final value of `default_tag`. def preserve_default_tag(person, _options) return unless (account = person.account) account.default_tag.tap do next unless account.as_update.key?("default_tag") next unless (original = person.original_doc.dig("account", "default_tag")) person.account.default_tag = original return original end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems