<commit_before>class Membership < ApplicationRecord
  belongs_to :group
  belongs_to :person

  enum role: [:member, :organizer]

  scope :organizer, -> () { where(role: 'organizer') }
  scope :member, -> () { where(role: 'member') }
end
<commit_msg>prevent a person from being a member of the same group twice<commit_after>class Membership < ApplicationRecord
  belongs_to :group
  belongs_to :person

  validates :person_id, uniqueness: { scope: :group_id }

  enum role: [:member, :organizer]

  scope :organizer, -> () { where(role: 'organizer') }
  scope :member, -> () { where(role: 'member') }
end

{'fraction_non_alphanumeric': 0.1371900826446281, 'fraction_numerical': 0.0, 'mean_word_length': 4.611111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1324912', 'n_tokens_mistral': 197, 'n_tokens_neox': 194, 'n_words': 56}