<commit_before># frozen_string_literal: true

# Provides methods to invite a new member to an existing project
class ProjectUser < ApplicationRecord
  # Model Validation
  validates :project_id, :creator_id, presence: true
  validates :invite_token, uniqueness: true, allow_nil: true

  # Model Relationships
  belongs_to :project
  belongs_to :user
  belongs_to :creator, class_name: 'User', foreign_key: 'creator_id'

  after_update :notify_user

  def generate_invite_token!(new_invite_token = generate_token)
    save_invite_token new_invite_token<commit_msg>Replaced deprecated after_update method with after_update_commit<commit_after># frozen_string_literal: true

# Provides methods to invite a new member to an existing project
class ProjectUser < ApplicationRecord
  # Model Validation
  validates :project_id, :creator_id, presence: true
  validates :invite_token, uniqueness: true, allow_nil: true

  # Model Relationships
  belongs_to :project
  belongs_to :user
  belongs_to :creator, class_name: 'User', foreign_key: 'creator_id'

  after_update_commit :notify_user

  def generate_invite_token!(new_invite_token = generate_token)
    save_invite_token new_invite_token
{'fraction_non_alphanumeric': 0.05912162162162162, 'fraction_numerical': 0.0, 'mean_word_length': 6.225609756097561, 'pattern_counts': {'":': 0, '<': 5, '<?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': '783467', 'n_tokens_mistral': 369, 'n_tokens_neox': 360, 'n_words': 102}