<commit_before>module Setup
  module SharedConfigurable
    extend ActiveSupport::Concern

    include CrossOriginShared

    included do
      after_save { configure }
    end

    def configure
    end

    def save(options = {})
      if shared? && User.current != creator
        valid? && configure
        errors.blank?
      else
        super
      end
    end

    module ClassMethods

      def configuring_fields
        @configuring_fields ||= Set.new
      end

      def shared_configurable(*args)
        configuring_fields.merge(args.collect(&:to_s).select(&:present?))
      end

      def tracked_field?(field, action = :update)
        configuring_fields.exclude?(field.to_s) && super
      end
    end
  end
end<commit_msg>Including callbacks as validator when updating cross shared records<commit_after>module Setup
  module SharedConfigurable
    extend ActiveSupport::Concern

    include CrossOriginShared

    included do
      after_save { configure }
    end

    def configure
    end

    def save(options = {})
      if shared? && User.current != creator
        run_callbacks(:save) && configure
        errors.blank?
      else
        super
      end
    end

    module ClassMethods

      def configuring_fields
        @configuring_fields ||= Set.new
      end

      def shared_configurable(*args)
        configuring_fields.merge(args.collect(&:to_s).select(&:present?))
      end

      def tracked_field?(field, action = :update)
        configuring_fields.exclude?(field.to_s) && super
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07593307593307594, 'fraction_numerical': 0.0, 'mean_word_length': 2.3585313174946005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5381277', 'n_tokens_mistral': 444, 'n_tokens_neox': 424, 'n_words': 107}