<commit_before>class LinksController < ApplicationController
  skip_before_filter  :verify_authenticity_token

  def destroy
    folder = Folder.find(params[:folder_id])

    link_dependencies = FolderLink.where(link_id: params[:id])
    if link_dependencies == 1
      Link.find(params[:id]).destroy
      redirect_to folder_path(folder)
    else
      folder_link = FolderLink.where(link_id: params[:id],
                                      folder_id: params[:folder_id])
      folder_link[0].destroy
    end

    redirect_to folder_path(folder)<commit_msg>Link destroy method now destroys the folderlink in all situations<commit_after>class LinksController < ApplicationController
  skip_before_filter  :verify_authenticity_token

  def destroy
    folder = Folder.find(params[:folder_id])

    link_dependencies = FolderLink.where(link_id: params[:id])
    
    if link_dependencies == 1
      Link.find(params[:id]).destroy
      folder_link = FolderLink.where(link_id: params[:id],
                                      folder_id: params[:folder_id])
      folder_link[0].destroy
    else
      folder_link = FolderLink.where(link_id: params[:id],
                                      folder_id: params[:folder_id])
      folder_link[0].destroy
    end

    redirect_to folder_path(folder)
{'fraction_non_alphanumeric': 0.08628659476117104, 'fraction_numerical': 0.003852080123266564, 'mean_word_length': 2.9363636363636365, '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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505149', 'n_tokens_mistral': 378, 'n_tokens_neox': 356, 'n_words': 68}