<commit_before>DocumentsController.class_eval do

  def allowed_params
    [:file, :language, :age_min, :age_max, :tag_list=>[]]
  end
  
  def create
    super do |format|
      if resource.is_a? Zipfile
        newResource = resource.getResourceAfterSave
        if newResource.is_a? String
          #Raise error
          flash.now[:alert] = newResource
          render action: :new
        else
          redirect_to newResource
        end
        return
      end
      
      format.json { render :json => resource.to_json(helper: self), status: :created }
      format.js
      format.all {
        if resource.new_record?
          render action: :new
        elsif params["document"]["add_holder_event_id"]
          redirect_to request.referer #we are adding poster to an event, redirect to the event
        else
          redirect_to resource
        end
      }
    end
  end

  # def create
  #   super do |format|
  #     format.json { render :json => resource.to_json(helper: self), status: :created }
  #     format.js
  #     format.all {
  #       if resource.new_record?
  #         render action: :new
  #       elsif params["document"]["add_holder_event_id"]
  #         redirect_to request.referer #we are adding poster to an event, redirect to the event
  #       else
  #         redirect_to resource
  #       end
  #     }
  #   end
  # end

  def update
    update! do |success, failure|
      failure.html { render :action => :show }
      success.html {
        if params[:controller] == "pictures"
          redirect_to request.referer
        else
          render :action => :show 
        end
      }
    end
  end

  def destroy
    super do |format|
      format.html {
        redirect_to current_user
      }

      format.js
    end
  end
<commit_msg>Minor changes on docs controller<commit_after>DocumentsController.class_eval do

  def allowed_params
    [:file, :language, :age_min, :age_max, :tag_list=>[]]
  end
  
  def create
    super do |format|
      if resource.is_a? Zipfile
        newResource = resource.getResourceAfterSave
        if newResource.is_a? String
          #Raise error
          flash.now[:alert] = newResource
          render action: :new
        else
          redirect_to newResource
        end
        return
      end
      
      format.json { render :json => resource.to_json(helper: self), status: :created }
      format.js
      format.all {
        if resource.new_record?
          render action: :new
        elsif params["document"]["add_holder_event_id"]
          redirect_to request.referer #we are adding poster to an event, redirect to the event
        else
          redirect_to resource
        end
      }
    end
  end

  def update
    update! do |success, failure|
      failure.html { render :action => :show }
      success.html {
        if params[:controller] == "pictures"
          redirect_to request.referer
        else
          render :action => :show 
        end
      }
    end
  end

  def destroy
    super do |format|
      format.html {
        redirect_to current_user
      }

      format.js
    end
  end

{'fraction_non_alphanumeric': 0.07901471529110685, 'fraction_numerical': 0.0, 'mean_word_length': 1.8583180987202925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '3229809', 'n_tokens_mistral': 912, 'n_tokens_neox': 902, 'n_words': 254}