<commit_before>class BoxesController < ApplicationController
  layout 'box', except: %w(edit)
  before_filter :find_box, only: %w(show edit download update)

  def create
    box = Box.create! params: params[:box]
    redirect_to box_url(box)
  end

  def default
    render json: DefaultConfiguration.new.get
  end

  def show
    respond_to do |format|
      format.html
      format.json { render json: @box }
    end
  end

  def edit
  end

  def update
    @box.update_attributes params: params
    redirect_to box_url(@box), notice: t('updated')
  end

  def download
    configurator = Configurator.from_params(@box.params)
    builder = ConfigurationBuilder.new(configurator)
    zip_path = builder.build
    send_file zip_path, filename: configurator.file_name
  end

  private

  def find_box
    @box = Box.where(secure_id: params[:id]).first!
  end
end<commit_msg>Fix update<commit_after>class BoxesController < ApplicationController
  layout 'box', except: %w(edit)
  before_filter :find_box, only: %w(show edit download update)

  def create
    box = Box.create! params: params[:box]
    redirect_to box_url(box)
  end

  def default
    render json: DefaultConfiguration.new.get
  end

  def show
    respond_to do |format|
      format.html
      format.json { render json: @box }
    end
  end

  def edit
  end

  def update
    @box.update_attributes params: params[:box]
    redirect_to box_url(@box), notice: t('updated')
  end

  def download
    configurator = Configurator.from_params(@box.params)
    builder = ConfigurationBuilder.new(configurator)
    zip_path = builder.build
    send_file zip_path, filename: configurator.file_name
  end

  private

  def find_box
    @box = Box.where(secure_id: params[:id]).first!
  end
end
{'fraction_non_alphanumeric': 0.08708025042686397, 'fraction_numerical': 0.0, 'mean_word_length': 3.4393939393939394, 'pattern_counts': {'":': 0, '<': 5, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2118829', 'n_tokens_mistral': 569, 'n_tokens_neox': 552, 'n_words': 150}