class PollsController < ApplicationController
  unloadable

  # before_filter :find_project, :authorize, :only => :index
  # before_filter :find_project, :authorize, :only => :vote

  def index
    @project = Project.find(params[:project_id]) #comment out this line when using permissions
	@polls = Poll.find(:all)
  end

  def vote
    poll = Poll.find(params[:id])
    poll.vote(params[:answer])
    if poll.save
      flash[:notice] = 'Vote saved.'
    end
    redirect_to :action => 'index', :project_id => params[:project_id]
  end
  
  #end #possible location of definition end that broke voting when permissions enabled
  
  # private
  
  # def find_project
  # # @project variable must be set before calling the authorize filter
	# @project = Project.find(params[:project_id])
  # end
  
end