<commit_before>module Locked
  module ActsAsLocked
    extend ActiveSupport::Concern

    included do

    end

    module ClassMethods
      def acts_as_locked(options = {})
        cattr_accessor :fields
        self.fields = options.delete(:fields)

        validate :changes_on_lock
      end
    end

    def lockable?
      flag = true
      self.fields.each do |field|
        flag = false unless self.send(field.to_sym) if flag
      end
      flag
    end

    def lock!
      self.locked = Date.today if lockable?
    end

    def unlock!
      self.locked = nil
    end

    def locked?
      self.locked_at != nil
    end

    private
    def changes_on_lock
      if locked_at
        self.fields.each do |field|
          errors.add(field.to_sym, "Este campo no puede ser modificado") if self.send("#{field}_changed?")
        end
      end
    end
  end<commit_msg>FIX: Camvio el tipo de locket_at a Time<commit_after>module Locked
  module ActsAsLocked
    extend ActiveSupport::Concern

    included do

    end

    module ClassMethods
      def acts_as_locked(options = {})
        cattr_accessor :fields
        self.fields = options.delete(:fields)

        validate :changes_on_lock
      end
    end

    def lockable?
      flag = true
      self.fields.each do |field|
        flag = false unless self.send(field.to_sym) if flag
      end
      flag
    end

    def lock!
      self.locked_at = Time.now if lockable?
    end

    def unlock!
      self.locked = nil
    end

    def locked?
      self.locked_at != nil
    end

    private
    def changes_on_lock
      if locked_at
        self.fields.each do |field|
          errors.add(field.to_sym, "Este campo no puede ser modificado") if self.send("#{field}_changed?")
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.06883044208170118, 'fraction_numerical': 0.0, 'mean_word_length': 1.9602649006622517, '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': '333083', 'n_tokens_mistral': 561, 'n_tokens_neox': 543, 'n_words': 156}