<commit_before># encoding: UTF-8
class LunchesController < ApplicationController
  before_filter :initialize_votes

  def handle_unverified_request
    reset_session
    if request.xhr?
      flash[:error] = "Istuntosi oli vanhentunut. Yritä uudelleen."
      render :js => "window.location = '/'"
    end
  end

  def index
    @lunches_by_date = Lunch.lunches_by_date
  end

  def vote
    @lunch = Lunch.find(params[:id])

    if session[:votes].add? params[:id]
      @lunch.add_vote
    end

    respond_to do |format|
      format.html { redirect_to root}
      format.js
    end
  end

  private

  def initialize_votes
    session[:votes] ||= Set.new
  end
end<commit_msg>Small tweak to csrf handling.<commit_after># encoding: UTF-8
class LunchesController < ApplicationController
  before_filter :initialize_votes

  def handle_unverified_request
    reset_session
    if request.xhr?
      flash[:error] = "Istuntosi oli vanhentunut. Yritä uudelleen."
      render :js => "window.location = '/'"
    else
      redirect_to root_path
    end
  end

  def index
    @lunches_by_date = Lunch.lunches_by_date
  end

  def vote
    @lunch = Lunch.find(params[:id])

    if session[:votes].add? params[:id]
      @lunch.add_vote
    end

    respond_to do |format|
      format.html { redirect_to root}
      format.js
    end
  end

  private

  def initialize_votes
    session[:votes] ||= Set.new
  end
end
{'fraction_non_alphanumeric': 0.08846426043878274, 'fraction_numerical': 0.0014154281670205238, 'mean_word_length': 2.8953168044077136, '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': '7232642', 'n_tokens_mistral': 494, 'n_tokens_neox': 481, 'n_words': 114}