Sha256: bcc26d3941f306f86642ab77043eeca68cd99fda456e86760cb465b7ae58f126

Contents?: true

Size: 495 Bytes

Versions: 9

Compression:

Stored size: 495 Bytes

Contents

class VotesController < BaseController
  before_filter :find_choice, :only => [:create]
  before_filter :login_required
  
  def new
    @post = Post.find(params[:post_id])
    redirect_to user_post_path(@post.user, @post)
  end
  
  def create
    @vote = @choice.votes.new(:user => current_user, :poll => @choice.poll )
    
    @vote.save
    respond_to do |format|
      format.js
    end
  end
  
  protected
  
  def find_choice
    @choice = Choice.find(params[:choice_id])    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
community_engine-3.0.0 app/controllers/votes_controller.rb
community_engine-2.3.2 app/controllers/votes_controller.rb
community_engine-2.3.1 app/controllers/votes_controller.rb
community_engine-2.3.0 app/controllers/votes_controller.rb
community_engine-2.1.0 app/controllers/votes_controller.rb
community_engine-2.0.0 app/controllers/votes_controller.rb
community_engine-2.0.0.beta3 app/controllers/votes_controller.rb
community_engine-2.0.0.beta2 app/controllers/votes_controller.rb
community_engine-2.0.0.beta1 app/controllers/votes_controller.rb