1 # Selectricity: Voting Machinery for the Masses
2 # Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
3 # Copyright (C) 2007 Massachusetts Institute of Technology
5 # This program is free software. Please see the COPYING file for
8 # Filters added to this controller will be run for all controllers in
9 # the application. Likewise, all the methods added will be available
10 # for all controllers.
12 class ApplicationController < ActionController::Base
13 include AuthenticatedSystem
15 require_dependency "user"
18 before_filter :add_stylesheets
19 #before_filter :use_sitealizer
25 # this is defined is a sketchy way in the sitealizer mixin
26 # initalize. since i'm overloading that, i'm calling it here
27 $visits = [] unless $visits
31 file = "#{Dir.pwd}/public/stylesheets/#{controller_name}.css"
33 @stylesheets << controller_name
37 #both election_controller and quickvote_controller need this method
40 @vote = Vote.find(params[:id])
42 @vote.rankings.each do |ranking|
43 ranking.rank = params['rankings-list'].index(ranking.candidate.id.to_s) + 1
46 render :nothing => true