<commit_before>class Admin::CategoriesController < Admin::AdminController
  
  def index
    @categories = Category.all_public
  end
  
  def new 
    @category = Category.new(:channel_id => params[:channel_id])
  end
  
  def create
    @category = Category.new(params[:category])
    
    respond_to do |wants|
      if @category.save
        flash[:notice] = 'Category was successfully created.'
        wants.html { redirect_to(admin_categories_path) }
        wants.xml { render :xml => @category, :status => :created, :location => @category }
      else
        wants.html { render :action => "new" }
        wants.xml { render :xml => @category.errors, :status => :unprocessable_entity }
      end
    end
  end
  
  def edit
    @category = Category.find(params[:id])
    render :action => 'new'
  end
  
  def update
    @category = Category.find(params[:id])
    @category.update_attributes params[:category]
    flash[:notice] = 'Category updated'
    redirect_to admin_categories_path
  end
  
end<commit_msg>stuff<commit_after>class Admin::CategoriesController < Admin::AdminController
  
  def index
    @categories = Category.all_public
  end
  
  def new 
    @category = Category.new(:channel_id => params[:channel_id])
  end
  
  def create
    @category = Category.new(params[:category])
    
    respond_to do |wants|
      if @category.save
        flash[:notice] = 'Category was successfully created.'
        wants.html { redirect_to(admin_categories_path) }
        wants.xml { render :xml => @category, :status => :created, :location => @category }
      else
        wants.html { render :action => "new" }
        wants.xml { render :xml => @category.errors, :status => :unprocessable_entity }
      end
    end
  end
  
  def edit
    @category = Category.find(params[:id])
    render :action => 'new'
  end
  
  def update
    @category = Category.find(params[:id])
    @category.update_attributes params[:category]
    flash[:notice] = 'Category updated'
    redirect_to admin_categories_path
  end
  
  def destroy
    @category = Category.find(params[:id])
    @category.destroy
    flash[:notice] = "Category was destroyed."
    redirect_to admin_categories_path
  end  
  
end
{'fraction_non_alphanumeric': 0.11272068809416025, 'fraction_numerical': 0.0, 'mean_word_length': 2.996383363471971, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '6029635', 'n_tokens_mistral': 655, 'n_tokens_neox': 657, 'n_words': 157}