<commit_before>class SpartansController < ApplicationController


  def index
    if current_spartan.admin == true
      @spartans = Spartan.all
    else
      redirect_to '/'
    end
  end

  def show
    @spartan = Spartan.find(params[:id])
  end

  def destroy
    @spartan = Spartan.find(params[:id])
    @spartan.destroy!
    redirect_to '/spartans'
  end

  
  
end<commit_msg>trying to access as a non admin /spartans redirects to home<commit_after>class SpartansController < ApplicationController


  def index
    if spartan_signed_in?
      if current_spartan.admin
        @spartans = Spartan.all
      end
    else
      redirect_to '/'
    end
  end

  def show
    @spartan = Spartan.find(params[:id])
  end

  def destroy
    @spartan = Spartan.find(params[:id])
    @spartan.destroy!
    if spartan_signed_in?
      if current_spartan.admin
        redirect_to '/spartans'
      end
    else
      redirect_to '/'
    end
  end

  
  
end
{'fraction_non_alphanumeric': 0.07861635220125786, 'fraction_numerical': 0.0, 'mean_word_length': 2.435251798561151, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2962574', 'n_tokens_mistral': 341, 'n_tokens_neox': 311, 'n_words': 75}