<commit_before>BotApi.define_resource :channels do

  id :slack_id
  scope { Channel }
  collection { |scope| scope.all }
  new_instance do |scope, context|
    scope.new slack_id: context.request_id, **context.request_attributes
  end
  instance { |scope, slack| scope.find_by!(slack_id: slack) }

  attribute :name, types.String, 'The name of the Slack Team.'

  relates_to_one :team, resource: :teams
  relates_to_many :messages do
    create do |context|
      update_instance context
    end
  end

  update do |context|
    update_instance context
  end

  list only_associated: true

end<commit_msg>create instance<commit_after>BotApi.define_resource :channels do

  id :slack_id
  scope { Channel }
  collection { |scope| scope.all }
  new_instance do |scope, context|
    scope.new slack_id: context.request_id, **context.request_attributes
  end
  instance { |scope, slack| scope.find_by!(slack_id: slack) }

  attribute :name, types.String, 'The name of the Slack Team.'

  relates_to_one :team, resource: :teams
  relates_to_many :messages do
    create do |context|
      create_instance context
    end
  end

  update do |context|
    update_instance context
  end

  list only_associated: true

end
{'fraction_non_alphanumeric': 0.08237232289950576, 'fraction_numerical': 0.0, 'mean_word_length': 3.86, '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': '5774325', 'n_tokens_mistral': 404, 'n_tokens_neox': 385, 'n_words': 114}