<commit_before>class Admin::DynamicArraysController < Admin::AdminController
  before_filter :load_arrays, :only => [:index]
  before_filter :load_array, :only => [:show, :edit, :update, :destroy]
  before_filter :load_new_array, :only => [:new, :create]

  def index
  end

  def new
  end

  def create
    if @array.save
      flash[:notice] = 'Array was created.'
      redirect_to [:admin, @array]
    else
      render :new
    end
  end

  def show
  end

  def edit
  end

  def update
    if @array.update_attributes(params[:dynamic_array])
      flash[:notice] = 'Array was updated.'
      redirect_to [:admin, @array]
    else
      render :edit
    end
  end

  def destroy
    @array.destroy
    flash[:notice] = 'Array was deleted.'
    redirect_to admin_arrays_path
  end


protected

  def load_arrays
    @arrays = DynamicArray.all(:order => 'name ASC')<commit_msg>destroy redirect correction<commit_after>class Admin::DynamicArraysController < Admin::AdminController
  before_filter :load_arrays, :only => [:index]
  before_filter :load_array, :only => [:show, :edit, :update, :destroy]
  before_filter :load_new_array, :only => [:new, :create]

  def index
  end

  def new
  end

  def create
    if @array.save
      flash[:notice] = 'Array was created.'
      redirect_to [:admin, @array]
    else
      render :new
    end
  end

  def show
  end

  def edit
  end

  def update
    if @array.update_attributes(params[:dynamic_array])
      flash[:notice] = 'Array was updated.'
      redirect_to [:admin, @array]
    else
      render :edit
    end
  end

  def destroy
    @array.destroy
    flash[:notice] = 'Array was deleted.'
    redirect_to admin_dynamic_arrays_path
  end


protected

  def load_arrays
    @arrays = DynamicArray.all(:order => 'name ASC')
{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.0, 'mean_word_length': 3.0892448512585813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7243193', 'n_tokens_mistral': 593, 'n_tokens_neox': 564, 'n_words': 161}