<commit_before>class EventsController < ApplicationController
  respond_to :html, :ics

  has_scope :search
  has_scope :start_at
  has_scope :end_at
  has_scope :venue
  has_scope :address
  has_scope :city
  has_scope :country
  has_scope :state
  has_scope :zip
  has_scope :category

  def index
    find_all_events
    
    respond_with do |format|
      format.html do
        @events = @events.paginate(:page => params[:page], :per_page => 20)
        find_page
        present(@page)
      end
      format.ics  { render :text => Event.to_ics(@events, RiCal.Calendar, method(:event_url)) }
    end
  end

  def show
    @event = Event.find(params[:id])
    
    respond_with do |format|
      format.html do
        find_page
        @upcoming = Event.unexpired.order("start_at ASC").where("id != ?", @event.id).limit(10)
        @other_dates = @event.description.events.unexpired.where("events.id != ?", @event.id)
        present(@page)
      end
      format.ics  { render :text => @event.to_ics(RiCal.Calendar, method(:event_url)) }
    end
  end

protected

  def find_all_events
    base = params[:start_at].blank? ? Event.unexpired : Event
    @events = apply_scopes(base).order("start_at ASC").all
  end

  def find_page
    @page = Page.where(:link_url => "/events").first
  end

end
<commit_msg>Workes now with will_paginate >= 3.0.0<commit_after>class EventsController < ApplicationController
  respond_to :html, :ics

  has_scope :search
  has_scope :start_at
  has_scope :end_at
  has_scope :venue
  has_scope :address
  has_scope :city
  has_scope :country
  has_scope :state
  has_scope :zip
  has_scope :category

  def index
    find_all_events
    
    respond_with do |format|
      format.html do
        @events = @events.paginate(:page => params[:page], :per_page => 20)
        find_page
        present(@page)
      end
      format.ics  { render :text => Event.to_ics(@events, RiCal.Calendar, method(:event_url)) }
    end
  end

  def show
    @event = Event.find(params[:id])
    
    respond_with do |format|
      format.html do
        find_page
        @upcoming = Event.unexpired.order("start_at ASC").where("id != ?", @event.id).limit(10)
        @other_dates = @event.description.events.unexpired.where("events.id != ?", @event.id)
        present(@page)
      end
      format.ics  { render :text => @event.to_ics(RiCal.Calendar, method(:event_url)) }
    end
  end

protected

  def find_all_events
    base = params[:start_at].blank? ? Event.unexpired : Event
    @events = apply_scopes(base).order("start_at ASC")
  end

  def find_page
    @page = Page.where(:link_url => "/events").first
  end

end

{'fraction_non_alphanumeric': 0.11824707215715904, 'fraction_numerical': 0.00415564790328674, 'mean_word_length': 2.970014992503748, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '4134746', 'n_tokens_mistral': 906, 'n_tokens_neox': 882, 'n_words': 192}