<commit_before>class AdvertisementsController < ApplicationController
  layout 'default'
  before_filter :admin_user, :except => :redirect

  def index
    @ads = Advertisement.paginate(:page => params[:page], :per_page => 100)
  end

  def show
    @ad = Advertisement.find(params[:id])
  end

  def new
    @ad = Advertisement.new
  end

  def edit
    @ad = Advertisement.find(params[:id])
  end

  def redirect<commit_msg>Actually working new and edit.<commit_after>class AdvertisementsController < ApplicationController
  layout 'default'
  before_filter :admin_user, :except => :redirect

  def index
    @ads = Advertisement.paginate(:page => params[:page], :per_page => 100)
  end

  def show
    @ad = Advertisement.find(params[:id])
  end

  def new
    @ad = Advertisement.new
  end

  def create
    @ad = Advertisement.new(params[:advertisement])
    if @ad.save
      flash[:success] = 'Advertisement added'
      redirect_to @ad
    else
      render :new
    end
  end

  def edit
    @ad = Advertisement.find(params[:id])
  end

  def update
    @ad = Advertisement.find(params[:id])
    if @ad.update_attributes(params[:advertisement])
      flash[:success] = 'Advertisement updated'
      redirect_to @ad
    else
      render :edit
    end
  end

  def redirect
{'fraction_non_alphanumeric': 0.10460577673692428, 'fraction_numerical': 0.00468384074941452, 'mean_word_length': 3.2733333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '517972', 'n_tokens_mistral': 439, 'n_tokens_neox': 387, 'n_words': 103}