<commit_before>require 'active_record'
require "acts_as_versioned"
require 'active_support/concern'

require "versioned_text/version"

module VersionedText
  module Behaviors
    extend ActiveSupport::Concern

    included do
      has_many field_param.to_sym, :polymorphic => true
    end
  end

  # VersionText
  #
  # * <tt>versionable</tt>: O ActiveRecord model que possui o texto
  # * <tt>text</tt>: texto a ser versionado
  # * <tt>user</tt>: usuário que executou a alteração
  #
  class VersionText < ::ActiveRecord::Base
    acts_as_versioned

    belongs_to :versionable, :polymorphic => true

    default_scope order(:version)
    scope :descending, lambda { reorder("version DESC") }
    scope :versionable_finder, lambda {|auditable_id, auditable_type| where(:auditable_id => auditable_id, :auditable_type => auditable_type)}
<commit_msg>adicionado alteracao para gerar versao somente quando altera o texto dos campos<commit_after>require 'active_record'
require "acts_as_versioned"
require 'active_support/concern'

require "versioned_text/version"

module VersionedText
  module Behaviors
    extend ActiveSupport::Concern

    included do
      has_many field_param.to_sym, :polymorphic => true
    end
  end

  # VersionText
  #
  # * <tt>versionable</tt>: O ActiveRecord model que possui o texto
  # * <tt>text</tt>: texto a ser versionado
  # * <tt>user</tt>: usuário que executou a alteração
  #
  class VersionText < ::ActiveRecord::Base
    acts_as_versioned :if_changed => [:text]

    belongs_to :versionable, :polymorphic => true

    default_scope order(:version)
    scope :descending, lambda { reorder("version DESC") }
    scope :versionable_finder, lambda {|auditable_id, auditable_type| where(:auditable_id => auditable_id, :auditable_type => auditable_type)}

{'fraction_non_alphanumeric': 0.09715242881072027, 'fraction_numerical': 0.0, 'mean_word_length': 4.688888888888889, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, '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': '3703438', 'n_tokens_mistral': 585, 'n_tokens_neox': 572, 'n_words': 145}