1 class SiteController < ApplicationController
3 model :user, :election, :account
6 @quickvotes = QuickVote.find(:all, ["quickvote = 1"]).sort {|a,b| b.enddate <=> a.enddate}[0..1]
7 # if the person claims they are logged in
10 # check to see that we actually have record of them
11 if User.find(:all, ["id = ?", session[:user].id]).length == 1
12 # if we have record of them, grab the list of their elections
13 session[:user] = User.find(session[:user])
14 @current_elections = session[:user].elections.sort do |a,b|
15 b.enddate <=> a.enddate
18 # if we have no record of them, set the session id back to
19 # nothing and start again