<commit_before>class << ActiveRecord::Base

  def notify_on(action, options = {})

    include NotifyOn::Creator

    ([self] + self.descendants).each do |klass|
      klass.class_eval do
        has_many :notifications, -> { preloaded },
                 :class_name => NotifyOn::Notification, :as => :trigger,
                 :dependent => :destroy
      end
    end

    attr_accessor :skip_notifications

    method_to_s = NotifyOn::Utilities.callback_method_name(action, options)

    send("after_#{(action.to_s == 'create') ? 'create' : 'save'}", method_to_s)

    define_method(method_to_s) do
      # The action trigger needs to be create, save, or a true condition.
      return unless %w(create save).include?(action.to_s) || send(action.to_sym)
      # An optional if condition must be missing or true.
      return unless options[:if].blank? || send(options[:if])
      # An optional unless condition must be missing or false.
      return unless options[:unless].blank? || !send(options[:unless])
      # Create the notification if we get past all our checks.<commit_msg>remove callback string deprecation warning<commit_after>class << ActiveRecord::Base

  def notify_on(action, options = {})

    include NotifyOn::Creator

    ([self] + self.descendants).each do |klass|
      klass.class_eval do
        has_many :notifications, -> { preloaded },
                 :class_name => NotifyOn::Notification, :as => :trigger,
                 :dependent => :destroy
      end
    end

    attr_accessor :skip_notifications

    method_to_s = NotifyOn::Utilities.callback_method_name(action, options)
    method_sym = method_to_s.to_sym

    send("after_#{(action.to_s == 'create') ? 'create' : 'save'}", method_sym)

    define_method(method_to_s) do
      # The action trigger needs to be create, save, or a true condition.
      return unless %w(create save).include?(action.to_s) || send(action.to_sym)
      # An optional if condition must be missing or true.
      return unless options[:if].blank? || send(options[:if])
      # An optional unless condition must be missing or false.
      return unless options[:unless].blank? || !send(options[:unless])
      # Create the notification if we get past all our checks.
{'fraction_non_alphanumeric': 0.11369740376007162, 'fraction_numerical': 0.0, 'mean_word_length': 3.2409867172675524, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3189758', 'n_tokens_mistral': 651, 'n_tokens_neox': 637, 'n_words': 183}