<commit_before>module TheRole
  module User
    extend ActiveSupport::Concern
    include TheRole::BaseMethods

    included do
      belongs_to :who, optional: true
      delegate :the_role, to: :who, allow_nil: true
    end

    def owner?(obj, user_id = nil)
      return false unless obj
      return true if admin?

      section_name = obj.class.to_s.tableize
      return true if moderator?(section_name)

      return id == obj.id if obj.is_a?(self.class)
<commit_msg>deal with nil<commit_after>module TheRole
  module User
    extend ActiveSupport::Concern
    include TheRole::BaseMethods

    included do
      belongs_to :who, optional: true
    end

    def the_role
      if who
        who.the_role
      else
        {}
      end
    end

    def owner?(obj, user_id = nil)
      return false unless obj
      return true if admin?

      section_name = obj.class.to_s.tableize
      return true if moderator?(section_name)

      return id == obj.id if obj.is_a?(self.class)

{'fraction_non_alphanumeric': 0.0715725806451613, 'fraction_numerical': 0.0, 'mean_word_length': 2.472027972027972, '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': '7642050', 'n_tokens_mistral': 308, 'n_tokens_neox': 301, 'n_words': 92}