<commit_before># Backup Controller
class BackupsController < AttachmentsController
  defaults :resource_class => Backup

  def create
    @backup = Backup.new(params[:backup])
    if @backup.save
      @backup.import

      redirect_to current_tenant
    else
      render :new
    end
  end

  def dump
    tenant = Tenant.find(params[:tenant_id])

    @backup = tenant.backups.build
    @backup.dump
    @backup.save!

    redirect_to current_tenant
  end

  def restore
    # TODO: access validation
    @backup = Backup.find(params[:id])
    @backup.restore

    redirect_to current_tenant
  end
end<commit_msg>Fix direct restore after backup upload.<commit_after># Backup Controller
class BackupsController < AttachmentsController
  defaults :resource_class => Backup

  def create
    @backup = Backup.new(params[:backup])
    if @backup.save
      @backup.restore

      redirect_to current_tenant
    else
      render :new
    end
  end

  def dump
    tenant = Tenant.find(params[:tenant_id])

    @backup = tenant.backups.build
    @backup.dump
    @backup.save!

    redirect_to current_tenant
  end

  def restore
    # TODO: access validation
    @backup = Backup.find(params[:id])
    @backup.restore

    redirect_to current_tenant
  end
end
{'fraction_non_alphanumeric': 0.07875894988066826, 'fraction_numerical': 0.0, 'mean_word_length': 3.0191693290734825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '914362', 'n_tokens_mistral': 386, 'n_tokens_neox': 381, 'n_words': 96}