<commit_before>module CampaignObjectHolderController
  extend ActiveSupport::Concern
  
  def campaign_object_params
    params.require(:campaign_object).permit(:name, :abstract, :campaign_id, :picture)
  end
  
  def campaign_object_attributes
    [:id, :name, :abstract, :campaign_id, :picture]
  end
  
  private
    def campaign_set
      campaign_object = CampaignObject.find_by(campaign_object_holder_id: params[:id])
      campaign = campaign_object.campaign unless campaign_object.nil?
      campaign ||= Campaign.find_by(id: params[:campaign_id])
      campaign ||= current_campaign
      if campaign.nil?
        flash[:error] = 'Unable to properly set the campaign'<commit_msg>Fixed bug where visiting index of campaign objects would choose wrong campaign.<commit_after>module CampaignObjectHolderController
  extend ActiveSupport::Concern
  
  def campaign_object_params
    params.require(:campaign_object).permit(:name, :abstract, :campaign_id, :picture)
  end
  
  def campaign_object_attributes
    [:id, :name, :abstract, :campaign_id, :picture]
  end
  
  private
    def campaign_set
      campaign = Campaign.find_by(id: params[:campaign_id])
      campaign_object = CampaignObject.find_by(campaign_object_holder_id: params[:id]) if campaign.nil?
      campaign ||= campaign_object.campaign unless campaign_object.nil?
      campaign ||= current_campaign
      if campaign.nil?
        flash[:error] = 'Unable to properly set the campaign'
{'fraction_non_alphanumeric': 0.0884167237834133, 'fraction_numerical': 0.0, 'mean_word_length': 4.488721804511278, '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': '2767366', 'n_tokens_mistral': 421, 'n_tokens_neox': 402, 'n_words': 98}